Shell Script Testing with Bats

We’ve all been there: a small shell script that starts as a quick helper suddenly becomes a critical part of your workflow. Then one day, it breaks - maybe because of a missing argument, a typo, or an unexpected input. Debugging at 2 AM isn’t fun. That’s why adding tests to your shell scripts is a lifesaver. With Bats (Bash Automated Testing System), you can catch these issues early and make your scripts as reliable as any other piece of software. ...

February 13, 2024 · 2 min · 286 words · Micha Kops

Git Snippets

Show commits from another branch not contained in current branch git cherry -v otherbranch + f7d6a569bb6912aac97fce9ac92c4302863fb0d9 thecommit Find deleted files git log --diff-filter=D --summary Create empty commit sometimes necessary for build/deploy pipelines …​ git commit --allow-empty -m "Empty-Commit" Cherry pick without commit git cherry-pick -n HASH Using vimdiff for diff set it via git config git config --global diff.tool vimdiff git config --global merge.tool vimdiff set it via ~/.gitconfig [diff] tool = vimdiff [merge] tool = vimdiff ...

March 1, 2010 · 4 min · 848 words · Micha Kops

Kubernetes Snippets

Fetch and Decode Secret You need to have jq installed to use this snippet! kubectl --context=my-context -n my-namespace get secret my-secret-name -o json | jq '.data | map_values(@base64d)' Rerun existing completed Job kubectl replace deletes the old job, if there is any error, your job definition is lost, don’t forget to save it first! Replace an existing Job with itself kubectl get job JOBNAME -o yaml | kubectl replace --force -f - ...

March 1, 2010 · 10 min · 2064 words · Micha Kops

Windows Snippets

Autostart Verzeichnis aufrufen Run from the command line (⊞+R) shell:startup List Processes on the Command Line tasklist | more Find by name tasklist /FI "IMAGENAME eq notepad.exe" Abbildname PID Sitzungsname Sitz.-Nr. Speichernutzung ========================= ======== ================ =========== =============== notepad.exe 23496 Console 3 14.516 K Kill Processes by PID or Name on the Command Line Kill by PID taskkill /F /PID PID_NUMBER Kill by Name taskkill /IM "notepad.exe" /F Find Process by Port used E.g. finding processes using port 9000. ...

March 1, 2010 · 1 min · 126 words · Micha Kops