The case of the ref matters in added Git worktrees — can be read in 2 minutes| til.codeinthehole.com
A Bash script I was working on had a while read loop that processed Git commit SHAs: git log --pretty=format:'%H' $OPTIONS | while read -r line; do ... done but it did nothing when the git log command only piped one SHA in. Why?| David Winterbottom's TILs
How to compare two ranges of commits. — can be read in 1 minute| til.codeinthehole.com
Using git rebase to run shell commands on each commit — can be read in 1 minute| til.codeinthehole.com
I recently gained a deeper understanding of when to use stdout and stderr in shell scripts. The definitions in Wikipedia are: — can be read in 1 minute| til.codeinthehole.com
It’s possible to define a retry strategy for a requests.Session instance by mounting a customised adapter: — can be read in 1 minute| til.codeinthehole.com
It’s sometimes useful to see the sizes of each Git commit — “size” as in the number of line additions and deletions.| David Winterbottom's TILs
There’s several gotchas to be aware of when using time_machine with Pytest fixtures.| David Winterbottom's TILs
After a recent brew upgrade I discovered that exa, the modern replacement for ls, had stopped being maintained and had been replaced by eza. — can be read in 2 minutes| til.codeinthehole.com
You can use Simon Willison’s excellent llm tool to query or edit Vim buffers by piping the contents of a visual selection to the llm. — can be read in 1 minute| til.codeinthehole.com
In a large monorepo, it’s helpful to have a .github/CODEOWNERS file that maps filepaths to owning teams, covering as much of the codebase as possible. — can be read in 1 minute| til.codeinthehole.com
You can use the mock.DEFAULT sentinel value.| David Winterbottom's TILs
I was surprised to learn today that this test passes: — can be read in 2 minutes| til.codeinthehole.com
TLDR: pass closed='left' to pd.Grouper when grouping by a Monday-to-Sunday week. — can be read in 2 minutes| til.codeinthehole.com
Just putting this here as I always forget. — can be read in 1 minute| til.codeinthehole.com
Bash includes a built-in compgen command that can list all the commands available in the current shell: — can be read in 1 minute| til.codeinthehole.com
The problem After running brew upgrade and upgrading Hugo from v0. — can be read in 1 minute| til.codeinthehole.com
Mypy has options for generating coverage reports. From the --help output: — can be read in 1 minute| til.codeinthehole.com
I had been under the impression that it was very awkward (if not impossible) to have an application’s pyproject. — can be read in 1 minute| til.codeinthehole.com
When interactive rebasing, it’s useful to be able to edit all the files in one particular commit. — can be read in 1 minute| til.codeinthehole.com
If you ensure your pyproject.toml contains:: [tool.ruff] extend-include = ["*. — can be read in 1 minute| til.codeinthehole.com
MacOS allows you to override and bind new keyboard shortcuts for an app. — can be read in 1 minute| til.codeinthehole.com
Problem I forgot my notepad and was editing a todo. — can be read in 1 minute| til.codeinthehole.com
If you have multiple displays connected to your Mac, you may have noticed that the app switcher (cmd+tab) only appears on the display where the Dock is located. — can be read in 1 minute| til.codeinthehole.com
pipx is a tool for installing standalone Python packages in isolated environments. — can be read in 2 minutes| til.codeinthehole.com
Problem: you have a pipeline like so: $cmd1 | $cmd2 | $cmd3 and you want to detect if $cmd1 exits with a exit code greater than 1. — can be read in 2 minutes| til.codeinthehole.com
I was trying to work out why this psql command wasn’t printing results in tab-separated format: — can be read in 1 minute| til.codeinthehole.com
The osascript command can run JavaScript as well as AppleScript for interacting with MacOS. — can be read in 1 minute| til.codeinthehole.com
The syntax is: > [!NOTE] > This is a note. — can be read in 1 minute| til.codeinthehole.com
Many projects I work on maintain two requirements lock files: — can be read in 1 minute| til.codeinthehole.com
Many Google sites such as Meet, Drive and Youtube can be run as Progressive Web Apps (PWAs), which means they run in their own Chrome application and are treated as separate apps in MacOS. — can be read in 1 minute| til.codeinthehole.com
It’s oddly hard to get popular Python HTTP servers to log as JSON. — can be read in 2 minutes| til.codeinthehole.com
Suppose you have a stream of text comprising JSON and non-JSON lines — e. — can be read in 1 minute| til.codeinthehole.com
I was trying to get uWSGI to log in JSON, following this nicely laid-out guide; but it wasn’t working. — can be read in 2 minutes| til.codeinthehole.com
By default, the output of: kubectl describe pod $POD_ID is a hard-to-read YAML blob. — can be read in 1 minute| til.codeinthehole.com
Not sure how I’ve never come across this before, but Markdown supports hard line breaks by ending a line with two spaces. — can be read in 2 minutes| til.codeinthehole.com
Until today, I had Vimium disabled for Github as I believed Github’s keyboard shortcuts were useful enough to warrant losing Vimium’s. — can be read in 1 minute| til.codeinthehole.com
When working with Jupyter Notebooks, the output of each cell does not need to be committed as: — can be read in 1 minute| til.codeinthehole.com
Slack provides an in: search modifier to narrow the scope of results to a given channel. — can be read in 1 minute| til.codeinthehole.com
Postgres has a statement_timeout setting that will abort statements that run longer than the specified number of milliseconds. — can be read in 1 minute| til.codeinthehole.com
For years, I’ve been using https://rain.today for background rain noise, but I recently discovered that macOS Ventura and iOS 15 can play rain noise too. — can be read in 1 minute| til.codeinthehole.com
Git’s for-each-ref command allows you to iterate over refs and print them according to the --format option. — can be read in 1 minute| til.codeinthehole.com
I learnt the hard way that the default shell settings for Github actions don’t catch command pipeline failures. — can be read in 1 minute| til.codeinthehole.com
Beware of using rg in a while read block when there’s no path argument. — can be read in 1 minute| til.codeinthehole.com
There’s a word_cloud generator package available from PyPI that can take its source text from STDIN: — can be read in 1 minute| til.codeinthehole.com
typos is a source code spell checker written Rust that’s useful for finding typos in code comments and variable names. — can be read in 1 minute| til.codeinthehole.com
If you create a load of fix-up commits using: — can be read in 1 minute| til.codeinthehole.com
I was trying to write a Vim function that would act on a visual selection but found it surprisingly difficult. — can be read in 2 minutes| til.codeinthehole.com
Consider this contrived function which either returns a list of tuples or a list of dicts depending on an argument value: — can be read in 1 minute| til.codeinthehole.com
Am slightly embarrassed to admit it but I’ve only just discovered the --patch option to git log which shows diff information for each commit. — can be read in 1 minute| til.codeinthehole.com
There’s a great article on cooking chicken by ThermoWorks, from which I learnt a few things. — can be read in 3 minutes| til.codeinthehole.com
You can create tabular data from JSON using jq to generate tab-separated output and column to format. — can be read in 1 minute| til.codeinthehole.com
I realised today that despite having installed a modern version of Bash (via brew install bash), I was still running Bash v3. — can be read in 2 minutes| til.codeinthehole.com
I use Github’s hub library to create pull requests with a command similar to: — can be read in 1 minute| til.codeinthehole.com
Django provides a custom DjangoJSONEncoder class that can encode datetime. — can be read in 1 minute| til.codeinthehole.com
Python convenience imports are where objects are imported into a package’s __init__. — can be read in 2 minutes| til.codeinthehole.com
It’s possible to use JQ to build JSON payloads as well as filter them. — can be read in 1 minute| til.codeinthehole.com
This form can cause flakey tests: from django import forms from django. — can be read in 2 minutes| til.codeinthehole.com
Consider this contrived test: from unittest import mock import pytest def get_config(): """Return a config object with a 'salutation' attribute. — can be read in 2 minutes| til.codeinthehole.com
Verify by creating a table and inserting a single row — can be read in 3 minutes| til.codeinthehole.com
Mypy doesn’t check types of empty functions, such as those whose implementation is pass, . — can be read in 1 minute| til.codeinthehole.com
Vim can be opened in quickfix mode by specifying an error file with the -q option: — can be read in 1 minute| til.codeinthehole.com
Slack’s lets you search for messages that have had a particular emoji reaction using a has: filter. — can be read in 1 minute| til.codeinthehole.com
Consider this test that creates an S3 bucket using moto: — can be read in 1 minute| til.codeinthehole.com
which is a command used to identify the location of executables; however it behaves differently on Zsh compared to Bash. — can be read in 2 minutes| til.codeinthehole.com
In normal conditions, an AWS load balancer will only route requests to healthy instances in its linked target group. — can be read in 1 minute| til.codeinthehole.com
Consider this dummy static site structure: mkdir -p docs/_build/ echo "hello " > docs/_build/index. — can be read in 1 minute| til.codeinthehole.com
When converting one type of exception to another in an except block, it’s best to explicitly chain them using the from keyword. — can be read in 1 minute| til.codeinthehole.com
Pytest’s pytest.mark.parametrize function supports an indirect argument that allows a parametrized test to have its parameter passed to a fixture function, rather than directly into the test function. — can be read in 1 minute| til.codeinthehole.com
Debian’s retry command allows you to repeatedly run a command until it succeeds. — can be read in 1 minute| til.codeinthehole.com
To create a table of contents for the current page in reStructuredText, use the following: — can be read in 1 minute| til.codeinthehole.com
Google Workspace admins can use the Email Log Search feature to inspect emails sent and received by Gmail. — can be read in 1 minute| til.codeinthehole.com
Github-flavoured markdown uses Linguist for syntax highlighting, and Linguist supports “Python console” as a language. — can be read in 1 minute| til.codeinthehole.com
Pytest will generate a JUnit-XML result report when run with the --junitxml option. — can be read in 1 minute| til.codeinthehole.com
Django’s override_settings decorator only works on functions and methods in subclasses of unittest. — can be read in 1 minute| til.codeinthehole.com
If you install the pytest-monitor package, then PyTest invocations will collect test profiling information in a SQLite database (called . — can be read in 1 minute| til.codeinthehole.com
Django’s date template filter (and underlying django.utils.dateformat module) support using S as a format character for the English ordinal suffix for the day of the month. — can be read in 1 minute| til.codeinthehole.com
Parsers like goldmark (the default parser for Hugo) support definition lists. — can be read in 1 minute| til.codeinthehole.com
dprint is a formatting platform written in Rust. It supports a Prettier plugin that can give a big performance increase via its incremental formatting functionality. — can be read in 1 minute| til.codeinthehole.com
By default ripgrep uses Rust’s regex crate for parsing regular expressions which does not support look-ahead or look-behind assertions. — can be read in 1 minute| til.codeinthehole.com
Say you want to build an array of values then print them out as a tab-separated line: — can be read in 1 minute| til.codeinthehole.com
All images and containers are stored in: ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw as opposed to Linux which uses the /var/lib/docker directory. — can be read in 1 minute| til.codeinthehole.com
Python’s functools.lru_cache binds two additional functions to decorated functions: — can be read in 1 minute| til.codeinthehole.com
Vale is an extensible syntax aware linter. It can integrate with Vim via Ale although there’s a gotcha to be aware of. — can be read in 1 minute| til.codeinthehole.com
The output from markdownlint-cli has this form: path/to/file.md:13:81 MD013/line-length Line length [Expected: 80; Actual: 102] which doesn’t load correctly into Vim’s quickfix list (via :cfile or :cexpr). — can be read in 1 minute| til.codeinthehole.com
Factory Boy has a useful SelfAttribute class that lets a field reference another field of the object being constructed. — can be read in 1 minute| til.codeinthehole.com
Loggly stores your JSON event data in a single ElasticSearch schema. — can be read in 1 minute| til.codeinthehole.com
There’s a plethora of filters that can be used with Github’s search functionality. — can be read in 1 minute| til.codeinthehole.com
Django supports using separate databases for specified models or apps. — can be read in 1 minute| til.codeinthehole.com
You can do this from the “Add members” section of the Group detail page. — can be read in 1 minute| til.codeinthehole.com
Django 2.2 (released in April 2019) introduced a setup method to the django. — can be read in 1 minute| til.codeinthehole.com
Use docker inspect like so: docker inspect -f "{{ . — can be read in 1 minute| til.codeinthehole.com
Bash provides a $SECONDS environment variable which, if used in a script, returns the number of seconds since the script was started. — can be read in 2 minutes| til.codeinthehole.com
Vim supports a range of special patterns that can transform the replacement value when performing a search and replace. — can be read in 1 minute| til.codeinthehole.com
During an interactive rebase, when you’ve fixed the conflicts or finished editing the commit you can run: — can be read in 1 minute| til.codeinthehole.com
Aurora PostgreSQL clusters have: Auto-scaling storage for persistent data (the “cluster volume”). — can be read in 1 minute| til.codeinthehole.com
Prior to being told about aws-mfa-v2 my ~/.aws/config file looked like this: — can be read in 1 minute| til.codeinthehole.com
Some commands in Postgres can’t be run inside a transaction (e. — can be read in 1 minute| til.codeinthehole.com
The --name-only option for git log restricts the output to the changed file paths but not their full diffs. — can be read in 1 minute| til.codeinthehole.com
Since installing vim-copilot, editing large files had become noticeably slow. — can be read in 2 minutes| til.codeinthehole.com