Looping Dates macOS

date on MacOS does not support --date, so a workaround is needed. Converting Date to unix epoch, adding one day in epoch and converting back. The Scripty Way Taken from a blog post #!/bin/zsh start=$year-01-01 end=$year-12-31 currentDateTs=$(date -j -f "%Y-%m-%d" $start "+%s") endDateTs=$(date -j -f "%Y-%m-%d" $end "+%s") offset=86400 while [ "$currentDateTs" -le "$endDateTs" ] do date=$(date -j -f "%s" $currentDateTs "+%Y-%m-%d") echo $date currentDateTs=$(($currentDateTs+$offset)) done The Brew Way As I found out long after writing the above you can simply brew install coreutils and get a date command with the --date option. [Read More]
macos  bash 

GitLab Merge Request from the CLI

Speed up your work with git by automatically creating Merge Requests for your git push

The Problem You want to push a branch to GitLab and automatically create a Merge Request (MR) for it. There are effectively three scenarios this can cover: Create a MR in draft state with a custom title Create a MR Create a MR and automatically merge if CI/CD pipeline succeeds Manually this is quite the process: Push branch to origin Copy link to create a MR Open the link, change fields to represent wanted state and submit The Solution GitLab offers push options1 that allow us to instruct it to do more than just plain git push. [Read More]

Download Full Website Copy

Sometimes it’s nice to download a best effort version of a website, for example before completely redesigning it.

domain=WEB.SITE
wget $domain --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains $domain
wget 

GumLab

My first ever product

As part of my goal to write a book I began looking at how to build a following and where to sell the book once it’s finished. On this journey I found Gumroad, a great place to sell digital products. Given my idea to sell a comprehensive library of code snippets besides the actual book I took a look at existing integrations between it and GitLab.com, my preferred git host. [Read More]

Delete Your Old VMware Snapshots

For the love of Pete, please delete your old snapshots regularly! Old snapshots have caused incidents and even outages more than once in my career and it is really easy to preemptively look for them and get them removed before anything happens. Why To put it plainly, they can cause issues - like 03:00 in the morning pager alert issues and additionally eat up storage space like crazy. Degraded performance of the VM having the snapshot Degraded performance to full outages for other VMs on the same data store due to rapidly increasing snapshot sizes VMware recommends a series of steps to reduce risk when using snapshots: [Read More]

Looking back at 2020, Four Months Of Blogging

A look back on four months of blogging and engaging the PowerShell community

The year is coming to an end, with all its ups and downs 2020 surely was challenging to say the least. I wanted to take this time to openly reflect on my first couple months of blogging and what the future holds for ps1.guru PS> $firstPost = Get-Date -Year 2020 -Month 09 -Day 13 PS> $latestPost = Get-Date -Year 2020 -Month 12 -Day 22 PS> New-TimeSpan $firstPost $latestPost | Select-Object Days Days ---- 100 So, how are things going? [Read More]

My Stand On Affiliate Links

What I think about affiliate links

Lets talk about affiliate links for a moment. TLDR: I will use affiliate links where it is possible for me, wich isn’t often to be honest Lets dig into it, starting with some basic assumptions I am making: Most of my posts are technical content where I do not recommend any products or services, so there are no opportunities for affiliate links to begin with In posts where I reference a product or service I do so because I think it is great and I really want to recommend it There are no negative effects for the reader when using my affiliate links There are benefits for me when you use the affiliate link, either monetary or in credit with the service - This helps me keep this blog up and running for everyone to benefit Given those assumptions I don’t see any reason why I should not use affiliate links. [Read More]