Skip to content

Instantly share code, notes, and snippets.

@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 / 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
#!/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 / setup.sh
Created March 6, 2018 16:37
setup for base20180306
#!/bin/bash
apt-get install sudo vim-nox wget tmux tcpdump strace htop iotop pv moreutils build-essential pkg-config autoconf zip unzip bzip2 libssl-dev zlib1g-dev libreadline-dev libexpat-dev libevent-dev libncurses-dev libnss-mdns
$ uname -a
Linux proton 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 GNU/Linux
@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
@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 )"
}