Skip to content

Instantly share code, notes, and snippets.

brew install colima docker docker-compose
colima start --network-address
# vi ~/.docker/config.json if historical config from docker desktop
# Create alpine bastion (that will live for a day)
kubectl -n my-namespace run bastion --image alpine --command sleep -- 1d
# Exec onto bastion -
# -i = interactive mode
# -t = tty terminal mode
kubectl -n my-namespace -it exec bastion -- ash
# Delete bastion
kubectl -n my-namespace delete pod bastion
@ianhomer
ianhomer / gist:fc2a69f041bf5dc8519896cbeadc9e79
Last active June 30, 2025 09:14
Kubernetes namespace stuck in terminating. Remove finalizers from resources.
kubectl api-resources --verbs=list --namespaced -o name |
xargs -n 1 kubectl get --ignore-not-found -n my-namespace -o name |
xargs -n 1 kubectl patch -n my-namespace -p '{"metadata":{"finalizers":null}}' --type merge
@ianhomer
ianhomer / Makefile
Last active June 15, 2025 18:37
Rebuild Latex file on change and refresh PDF preview
preview: my.pdf
my.pdf: my.tex
@echo "Reloading ..."
@pdflatex my.tex >/dev/null
@open my.pdf
@osascript refresh-preview.scpt
# Enable prom web Admin API - --web.enable-admin-api
# Tunnel to prometheues API
kubectl port-forward -n monitoring prometheus-prometheus-kube-prometheus-prometheus-0 9999:9090
# List __name__ value
curl -g http://localhost:9999/api/v1/label/__name__/values | jq | less
@ianhomer
ianhomer / gist:737f88dd73b77628d8159d4344cd6fa8
Last active January 2, 2023 09:21
Covert video to animated GIF with ffmpeg
export MOVIE=my
ffmpeg -i $MOVIE.mov -filter_complex "[0:v] palettegen=max_colors=32" palette.png
ffmpeg -i $MOVIE.mov -i palette.png -filter_complex "scale=640:-1:flags=lanczos[x];[x][1:v]paletteuse" -r 4 $MOVIE.gif
@ianhomer
ianhomer / recursive sed on files in a directory
Last active November 8, 2020 18:50
change foo to bar in all js files in folder
#
# Change foo to bar in all js,ts,jsx and tsx files
#
# - Mac variant (i.e. -i '' for inline)
# - Only sed on files that match - i.e. don't waste energy sedding when no need
# - output lines that have changed
# - don't scan node_modules and dist folders
# - ignore files with test in name
#
@ianhomer
ianhomer / audio_conversion_test.fish
Last active March 10, 2019 22:51
Convert audio into various formats for comparison
# Copy to .config/fish/functions/audio_conversion_test.fish
function audio_conversion_test
echo "Audio Conversion Test"
set in $argv
set name (echo $in | cut -d'.' -f1 | cut -d'-' -f1)
set name (string trim -- $name)
echo "Converting audio : $name"
ffmpeg -hide_banner -i $in
mkdir $name
@ianhomer
ianhomer / log-speedtest.sh
Last active June 6, 2021 17:22
Log Network Speed Test
#!/bin/bash
#
# brew install speedtest-cli
#
# crontab -e
# log speedtest
# 0 * * * * /path/log-speedtest.sh
export LOG=~/.speedtest.log
echo "----" >> ${LOG}
@ianhomer
ianhomer / keybase.md
Created January 8, 2019 10:30
keybase.md

Keybase proof

I hereby claim:

  • I am ianhomer on github.
  • I am ihomer (https://keybase.io/ihomer) on keybase.
  • I have a public key ASAM7_cGlNbSxYDMssH-OF8hxdRqsI0KnLdxwfp3v3-KsQo

To claim this, I am signing this object: