Monitor command for changes

I typically use this with ./monitor.sh lsusb to tell when an nvidia jetson is in flashing mode. Useful any time you find yourself typing the same command over and over again to check the status of something. Use it with nslookup to see when your DNS changes have propagated. Etc. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #!/usr/bin/env bash if [ "$#" -eq 0 ]; then echo "Usage: $0 <command_to_monitor> [arg1] [arg2] [...]" exit 1 fi command_to_monitor=("$@") while true; do result=$("${command_to_monitor[@]}") timestamp=$(date +"%Y-%m-%d %H:%M:%S") if [ "$result" != "$prev_result" ]; then printf "\e[1;34m%s\e[0m ------------ \n%s\n" "$timestamp" "$result" prev_result="$result" fi sleep 1 done

February 8, 2025 · 1 min

Tabletop Sim Bookbinder

Back during covid when I was using tabletop simulator a lot I used this script to bundle a bunch of PDFs on the internet into books for tabletop simulator. We had some tech illiterate players and the skeuomorphism of the interface as well as being able to grab their pieces really helped them out. Use it to bundle a bunch of characters sheets for you DnD games, or any other PDFs you can find. ...

January 24, 2020 · 2 min

Bayes-theorem probability object for sympy

This is a quick hack I did to support adding probabilities together using sympy, which is symbolic mathematics for python. Since the objects represent an equation, you can represent things like p(1/3)+p(1/4) without floating point errors. When not interacting with another probability, they’re treated as ordinary sympy numbers. Please do note that sympy has a stats model, including a probability object. That’s probably what you want to use for serious stats work. This is a dead-simple type for bayes theorem, and can’t do things like “what’s the probability that X==5”. ...

January 15, 2019 · 2 min