Stop all containers docker
To stop every running container in Docker, pass the output of docker ps -q to docker stop.
Inspired by Simon Willison’s Today I Learned series, here are bitesize posts explaining how to do something.
This is basically a list of public notes, for things I need to do semi-frequently, i.e - not often enough to cram into my memory. Hopefully some of them are useful to you too!
To stop every running container in Docker, pass the output of docker ps -q to docker stop.
You can install a spellchecking tool like ispell or aspell and use a package in Emacs to do spell checking, then fix words with a handful of shortcuts.
Change the default PIN and PUK on a YubiKey with the YubiKey Authenticator app, since it defaults to 123456 and you don't want that in case someone finds your key.
List the secrets in a GCP project and read the latest version of one with gcloud, grepping out just the bit you need.
To get the mail (MX) records for a domain, you can ask dig for them from the command line.
To dig into a JSON blob in Postgres, use the @> containment operator to match objects inside a JSON array.
To lock pick a pin tumbler you need two tools: a tensioner and a pick. Then you push the pins up past the shear line so you can turn the key.
Using rsync you can mirror one folder to another, deleting anything in the destination that isn't in the source.
To make a claim now that you only want to reveal later, you can shasum the message, post the hash publicly, then reveal the original later to prove it matches.
To grab rows between two dates, use BETWEEN in your WHERE clause.
On github.com your SSH keys show a fingerprint, not the full public key. So if you had multiple keys, how could you figure out which one maps back to the one on GitHub?
Search files recursively for a term with line numbers, or pipe find into grep to match on file names.
How do I tell what ports are in use on my computer?
Wrap psql in a small shell function and use COPY ... TO STDOUT WITH (FORMAT csv, HEADER true) to export a query straight to a CSV file.
Running gcloud run jobs describe shows a Cloud Run job's tasks, parallelism, container image, memory and more.
Grant a new Postgres user connect, schema usage and table privileges, then check what they've been granted.