Skip to content

Instantly share code, notes, and snippets.

@gardner
gardner / gist:9760e52201ae9673f8b6c8935ee95619
Created December 1, 2023 11:05
Create "animated gif" mp4
ffmpeg -i demo.mov \
-vf "fps=5,scale=1280:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-y demo.mp4
@gardner
gardner / gist:78721ccceaf9d341d9b27ae2ba1366ca
Created December 1, 2023 02:06
ffmpeg macos settings test for h264_videotoolbox
#!/bin/bash
for profile in baseline main high; do
for level in 30 31 32 40 41 42 50 51 52; do
echo output-$profile-$level.mp4
ffmpeg -i high-res.mov \
-c:v h264_videotoolbox -profile:v $profile -level $level \
-c:a aac \
-y \
output-$profile-$level.mp4
@gardner
gardner / jail.local
Created September 1, 2022 21:18
fail2ban with authelia
[authelia]
enabled = true
port = http,https,9091
filter = authelia
logpath = /var/log/authelia/authelia.log
maxretry = 3
bantime = 1d
findtime = 1d
chain = DOCKER-USER
@gardner
gardner / pre-push
Created January 15, 2022 00:33
Versioning a React app in a monorepo with no tags
#!/bin/sh
cd $(git rev-parse --show-toplevel)/ui
previous=$(npm version | grep rating-ui | awk -F"'" '{ print $4 }')
tickets=$(git log --oneline ./ | awk '{ print tolower($2) }' | sort | uniq | grep -i -E -o 'MX-[0-9]+' | wc | awk '{ print $1 }')
patch=$(($tickets % 10))
minor=$(($tickets % 100))
minor=${minor:0:1}
major=$(($tickets % 1000))
major=${major:0:1}
@gardner
gardner / nighthawk.sh
Created December 7, 2020 23:16
Get stats from Nighthawk M2 router
modelJson=''
get_value() {
val=$(echo $modelJson | grep "$1" | awk -F: ' { print $2 }' | sed 's/[,]//' | sed -e 's/^[[:space:]]//')
echo "${val//[^a-zA-Z0-9_ ]/}"
}
nighthawk() {
modelJson=$(curl -sL http://192.168.1.1/api/model.json)
rssi=$(get_value rssi)
battChargeLevel=$(get_value battChargeLevel)
@gardner
gardner / HOWTO-GARDNER.md
Last active January 10, 2024 22:59
How To Gardner

Communication

I want to ensure that communication is effective and doesn't interrupt deep focus. If you feel that I am communicating with you too frequently or about irrelevant topics, please let me know directly, and I'll take that into account for future communications.

Regarding email, I usually respond three times per day: in the morning before standup, midday before or after lunch, and in the evening before leaving (except on Fridays). If I use "reply-all," I expect someone in the "To:" field to respond unless the issue has already been addressed. It's okay to respond to these emails just to say who the best person is to answer the question. Everyone in the CC field is there to follow along, so please only move people to BCC after clearly announcing it in the email thread.

For chat, I'm generally signed in but will turn off notifications when on a call with someone or concentrating deeply. I believe in off-topic chat to build relationships and strengthen the organization's culture, so please invite

@gardner
gardner / debug.css
Created July 6, 2020 07:15
This is my favorite one
* { outline: solid 0.25rem hsla(210, 100%, 100%, 0.5); }
@gardner
gardner / replace.sh
Created June 7, 2020 05:45
convert docker-compose to use field extensions
#!/bin/bash
sed -i '/^version:.*/d' *.yml && \
sed -i '/^services:.*/d' *.yml && \
sed -i '/^networks:.*/d' *.yml && \
sed -i '/^ traefik_proxy:$/d' *.yml && \
sed -i '/^ external:$/d' *.yml && \
sed -i '/^ name: traefik_proxy$/d' *.yml && \
sed -i '/^ default:$/d' *.yml && \
sed -i '/^ driver: bridge$/d' *.yml && \
@gardner
gardner / fix_vscode_terrible_defaults.md
Created May 2, 2020 03:24
fix vscode terrible defaults
for name in $(ls *.conf | awk -F '.' '{ print $1 }'); do
pass=$(pwgen -1 32)
7za a ${name}.zip ${name}.conf -p${pass}
echo $pass > ${name}.txt
done