Parsing AWS instance data with jq

Semi-random amusing code snippet of the day:

aws ec2 describe-instances | jq << EOF
    .[][].Instances[]
    | select(.Tags[]?.Value == "production")
    | .PrivateIpAddress
EOF

read more...


ts: Timestamping stdout

Loving data as much as I do, I like to optimize things. To make sure I’m actually going the right way, it’s useful to time things. While it’s trivial in most languages to add timing, it’s even easier if you don’t have to.

read more...


update-dotfiles encryption

I do like having my dotfiles on GitHub. For one, it means that they’re always available when I set up a new machine. For two, others can see them and take whatever is interesting for their own dotfiles. But all that has a disadvantage: what if I want to store my SSH configs?

read more...


docker-bash and docker-stop-all

I’ve been using Docker a fair bit at work, so I’ve added a few quick aliases to my dotfiles make that a little bit easier:

  • docker-bash - attach a bash shell to the first available docker instance
  • docker-stop-all - stop all running docker instances

read more...


Updating dotfiles

After all of these updates to my dotfiles, I finally want something that I can use to keep them up to date. For that, let’s write a quick script that can do just that.

read more...


Regex search and replace

Another random task that I find myself doing distressingly often: performing a regular expression search and replace recursively across a bunch of files. You can do this relatively directly with tools like sed, but I can never quite remember the particularly flavor of regular expression syntax sed uses.

read more...


Git aliases: undo, ud, and wipe

A few new git aliases:

  • git undo - Undo the most recent commit, unstaging all new files
  • git up - Update remote branches and submodules, delete merged branches
  • git wipe - Remove all current changes, saving as a seperate branch

read more...