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)
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
.
Time.is
I often need to schedule meetings with participants in multiple timezones. My favourite feature of time.is is the ability to easily assemble a link like https://time.is/1400_3_Jul_2020_in_London/CEST/Toronto using a mix of geographic locations and timezone abbreviations. If you co-ordinate across multiple timezones a lot, this website is very useful and has a number of handy shortcuts and customisations available.
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.