Skip to content

Instantly share code, notes, and snippets.

@atomicstack
atomicstack / .Xdefaults
Last active June 1, 2021 19:50
make XQuartz's xterm less fugly
# xterm args:
# xterm -fg white -bg black -en utf8 -tn xterm-256color -fa inputmono:size=14 -fn inputmono:size=14 -geometry 90x30
# see also:
# https://web.archive.org/web/20100616023737/http://yarger.asu.edu/NMR/Xdefaults.html
# https://gist.github.com/tshanks/1145068/e04565f405098193f3fe79b123fa805d0102a5ab
# https://unix.stackexchange.com/questions/332316/configure-unreadable-tiny-small-huge-xterm-fonts
# man xterm
xterm*faceName:inputmono:style=Regular:size=14
@atomicstack
atomicstack / rpi_temperature-config.txt
Created May 31, 2021 22:37
a more sensible and less noisy fan config for raspberry pis with the poe hat.
dtoverlay=rpi-poe
dtparam=poe_fan_temp0=62000
dtparam=poe_fan_temp1=64000
dtparam=poe_fan_temp2=66000
dtparam=poe_fan_temp3=68000
@atomicstack
atomicstack / generate_ssh_key_2021.sh
Created March 22, 2021 09:18
ssh-key creation helper, 2021
key_name="${USER}_$(hostname -s)_$(date +%F)"; echo "creating $HOME/.ssh/${key_name}.pem..."; ssh-keygen -t ed25519 -f "$HOME/.ssh/${key_name}.pem" -C "$key_name"
@atomicstack
atomicstack / edit-path-interactively.sh
Created March 4, 2021 12:11
A shell function which spawns $EDITOR containing a $PATH declaration
function edit-path-interactively() {
eval "$( printf 'export PATH="%s"' "$PATH" | vipe )"
}
@atomicstack
atomicstack / benchmark_finds.sh
Created February 20, 2021 21:58
shitty, biased, unfair, apples-to-oranges benchmark of find against fd
#!/bin/bash
set -x
/usr/bin/time -l find $HOME 2>&1 1>/dev/null | grep -i real
/usr/bin/time -l find $HOME 2>&1 1>/dev/null | grep -i real
/usr/bin/time -l find $HOME 2>&1 1>/dev/null | grep -i real
/usr/bin/time -l find $HOME 2>&1 1>/dev/null | grep -i real
/usr/bin/time -l find $HOME 2>&1 1>/dev/null | grep -i real
@atomicstack
atomicstack / rpi-thermals.txt
Created November 2, 2020 00:35
reading thermals for the RPi without needing vcgencmd
rp1-cluster1 ~ % for zone in /sys/class/thermal/thermal_zone*; do echo -n "$(basename $zone)="; cat $zone/temp | perl -nE 'printf(qq{%.02fC\n}, ($_/1000))'; done
thermal_zone0=42.35C
@atomicstack
atomicstack / linux_mdns_query.txt
Created October 8, 2020 18:58
how to query mDNS from the linux CLI
lepton ~ % sudo apt install -y libnss-mdns avahi-utils
lepton ~ % avahi-resolve-host-name -4 rp1-cluster1.local
rp1-cluster1.local 10.0.0.167
@atomicstack
atomicstack / mac_mdns_query.txt
Created October 8, 2020 18:55
how to query mDNS from the CLI
muon ~ % dscacheutil -q host -a name rp1-cluster1.local
name: rp1-cluster1.local
ipv6_address: fe80:b::dea6:32ff:feba:101f
ipv6_address: fe80:e::dea6:32ff:feba:101f
name: rp1-cluster1.local
ip_address: 10.0.0.167
@atomicstack
atomicstack / fetch_raspberry_pi_firmware.sh
Last active August 29, 2023 22:56
a one-liner to fetch the latest revisions of /boot/*.{elf,dat} in the RPi firmware repository (because it's a 14GB repo and cloning takes forever, and we're only interested in ~20MB of data). requires the command line utils wget and jq
wget --base=https://github.com/raspberrypi/firmware/raw/master/ -i <( wget -qO - https://github.com/raspberrypi/firmware/tree/master/boot | jq -r '.payload.tree.items[].path | select(test("(elf|dat)$"))' )
# system-wide environment settings for zsh(1)
# unfucks PATH breakage inside tmux
# https://superuser.com/questions/544989/does-tmux-sort-the-path-variable
# https://apple.stackexchange.com/questions/248813/tmux-always-modify-my-zsh-path
if [[ -x /usr/libexec/path_helper && -z "$TMUX" ]]; then
eval `/usr/libexec/path_helper -s`
fi