Semi-random amusing code snippet of the day:
aws ec2 describe-instances | jq << EOF
.[][].Instances[]
| select(.Tags[]?.Value == "production")
| .PrivateIpAddress
EOF
Semi-random amusing code snippet of the day:
aws ec2 describe-instances | jq << EOF
.[][].Instances[]
| select(.Tags[]?.Value == "production")
| .PrivateIpAddress
EOF
I have a gif collection now. :)
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.
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?
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 instancedocker-stop-all
- stop all running docker instancesA couple of quick additions to my dotfiles today:
git find-fat
- find large files that no longer existgit trim-fat
- remove files entirely from git historyAfter 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.
Sometimes cat
just prints too quickly.
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.
A few new git aliases:
git undo
- Undo the most recent commit, unstaging all new filesgit up
- Update remote branches and submodules, delete merged branchesgit wipe
- Remove all current changes, saving as a seperate branch