How to do various things

General *nix

Run sed on every Rust source file in a directory (GNU):

find . -type f -name '*.rs' -exec sed -i 's/\(DataflowDesc::new(\)None/\1/' {} \;

Above for BSD:

find . -type f -name '*.rs' -exec sed -i '' 's/\(DataflowDesc::new(\)None/\1/' {} \;

Convert a Unix timestamp to a local date/time (GNU):

date -d @1571862547

Above for BSD:

date -r 1571862547

Get number of CPUs (BSD):

sysctl hw.ncpu

Ubuntu

Find files associated with a given package:

dpkg-query -L <package>

FreeBSD server admin

Renew LetsEncrypt certificate:

certbot-2.7 renew
service dovecot onerestart
service nginx onerestart
# And whatever else you might need to restart...

Docker

Blow away a bunch of stuff (caches, unused volumes, etc):

docker system prune -a && docker volume prune

Miscellaneous

Render Graphviz graph:

dot -T pdf < graph.dot > graph.pdf

Render this file:

rst2html < howtodo.rst > howtodo.html