Skip to content

Instantly share code, notes, and snippets.

[diff]
# external = git-diff-wrapper.sh
algorithm = patience
# colorMoved=plain
[pager]
diff =
[color]
diff = auto
$ perl -MDateTime -E 'printf( qq{%30s: %s\n}, $_, DateTime->now(time_zone => $_)->strftime(q{%a %F %T})) foreach qw{ US/Pacific US/Eastern Europe/London Europe/Amsterdam Europe/Berlin Asia/Singapore Australia/Melbourne }'
US/Pacific: Fri 2018-09-21 14:35:37
US/Eastern: Fri 2018-09-21 17:35:37
Europe/London: Fri 2018-09-21 22:35:37
Europe/Amsterdam: Fri 2018-09-21 23:35:37
Europe/Berlin: Fri 2018-09-21 23:35:37
Asia/Singapore: Sat 2018-09-22 05:35:37
Australia/Melbourne: Sat 2018-09-22 07:35:37
#!/bin/bash
# extract tarball and run from its root dir.
# wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz && tar -xvf Python-3.7.4.tgz
sudo make clean && ( env LDFLAGS=-Wl,-rpath,/usr/local/python-3.7.4/lib ./configure --enable-optimizations --enable-shared --with-ssl --prefix=/usr/local/python-3.7.4 && make && sudo make install ) |& ( ts '[%F %T] ' | tee -a build.log ) | pv -l -s 10000 > /dev/null
@atomicstack
atomicstack / nmap_build_info.txt
Created June 10, 2020 09:43
building nmap on macOS
% eval $( brew info openssl | egrep '(LDFLAGS|CPPFLAGS)' )
% export PYTHON=/usr/local/bin/python3
% ./configure --with-libpcap=included --prefix=$PWD
# 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
@atomicstack
atomicstack / fetch_raspberry_pi_firmware.sh
Last active May 6, 2025 12:36
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/raw/master/boot/ | grep 'react-app.embeddedData' | perl -nE 's{\s+<script[^>]+>}{}; s{</script>}{}; say' | jq -r '.payload.tree.items[].path | select(test("(elf|dat)$"))' )
@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 / 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 / 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 / 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