Skip to main content

Water.css

Water.css is a minimal responsive stylesheet. I sometimes use this when I'm prototyping something new or producing a demo website for a library. Drop it in your <head>, write semantic HTML, no classes needed. Good-enough styling when you don't want to think about styling.

Bat and Delta

Two for one this time. These tools are two peas in a pod:

  • Bat is a git-aware drop-in replacement for cat with syntax highlighting.
  • Delta builds on bat's syntax themes to provide a pager for git with improved diff highlighting.

I use both with the Nord theme. Git can be configured to use the delta/Nord combo as the default pager by setting

[core]
    pager = delta --theme=Nord

[interactive]
    diffFilter = delta --color-only --theme=Nord

in .gitconfig.

Blush

Blush hosts collections of customisable and composable images and designs which can be used under a permissive licence. Small PNGs (like this one generated from the cityscapes collection)

cityscape

are free to download. Large PNGs and SVGs are available with a paid plan.

Vendoring Ansible Galaxy Roles

By default ansible-galaxy installs all roles in a single global location. If you use ansible a lot, this can lead to a situation where you have a conflict because one project requires version X of a dependency and another requires version Y. I usually guard against this by setting each of my ansible projects up to install dependencies in a local vendor directory inside the project (the NPM/composer model) using the roles-path setting.

This can be specified on-the-fly with a flag or env var, but I usually set this in my ansible.cfg before creating a requirements.yml.

[defaults]
roles_path = ./vendor/

Get the size of a HTTP response

Vanilla verison:

curl "https://foo.bar/file" -w 'size: %{size_download}\n' -o /dev/null

or with a little extra flourish:

curl "https://foo.bar/file" -w 'size: %{size_download}\n' -o /dev/null | sed 's/[^0-9]//g' | numfmt --to=iec

The Silver Searcher

The Silver Searcher (or ag to its friends) has quickly become my go-to search tool for code. Performance gets top billing, but this tool has a number of other handy features. For example, searching ignores patterns in your .gitignore by default and ag is aware of a large number of programming languages and technologies. For example ag "search string" . --html searches only in files with the extensions .htm, .html, .shtml or .xhtml.

Editing Commit Timestamps in Git

I always forget that GitHub shows commits in a pull request in timestamp order rather than tree/history order until just after I've just pushed a monster rebase and everything's in the wrong order. To force GitHub to show the commits in the correct order, we need to edit the commit timestamps to match the history order. To do this:

git rebase -i HEAD~N

Mark the commits that need re-ordering as edit

edit f3b9e40 Reticulate Splines
edit 68f39b8 Adjust Bell Curves
edit d605e5a Dice Models

At each stage of the rebase:

git commit --amend --date=now --no-edit
git rebase --continue

Now the timestamp ordering will match the history. When you force-push, GitHub will order the commits correctly in your pull request.

mailtrap

Mailtrap.io is a simple and very useful service for developing code that sends email. Set up a project inbox, tell your application to use smtp.mailtrap.io/port 2525 for mail transport and give it the username and password for your project inbox. Any emails your application sends (regardless of the outward address) are swallowed (no danger of spamming a real user with test emails) and emails can be reviewed in the project inbox. The free plan is generous enough to cover moderate usage.

Moto

moto is a library that allows you to easily mock out tests based on AWS infrastructure.

This package is an absolute essential for testing and developing applications which are closely tied to the AWS stack.