Packaging a Python CLI tool for Homebrew
I finally figured out how to package Datasette for installation with Homebrew. My package was accepted into Homebrew core, which means you can now install it like this: brew install datasette Prior to…
320 posts tagged “til”.
I finally figured out how to package Datasette for installation with Homebrew. My package was accepted into Homebrew core, which means you can now install it like this: brew install datasette Prior to…
TIL the Python standard library struct module defaults to interpreting binary strings using the endianness of your machine. Which means that this code: Behaves differently on big-endian v.s.
tree-sitter is a "parser generator tool and an incremental parsing library". It has a very good reputation these days.
Given a large, heterogeneous table I wanted to identify patterns in the rows in terms of which columns were not null.
When giving a workshop it's often useful to have a URL to the workshop materials visible on screen at all times. I use a bit.ly link for these.
I wanted to write alt text for the following screenshot (of this page), so I could include it in this post on Mastodon.
I'm a big fan of snapshot testing - writing tests where you compare the output of some function to a previously saved version, and can re-generate that version from scratch any time something changes.
For sqlite-utils 364 I needed to write a test for a Click app which dealt with input streamed to standard input.
The goal: run Varnish in a Fly container as a caching proxy in front of another Fly application. I ended up switching to Cloudflare for running a Varnish-style cache in front of my Fly application…
For Datasette.app I wanted to ensure that links to external URLs would open in the system browser. This recipe works: The event fires before any in-browser navigations, which means they can be…
For simonw/museums 32 I wanted to have certain lines in my Bash script ignore any errors: lines that used to add columns and configure FTS, but that might fail with an error if the column already…
For s3-ocr issue 21 I needed to write a test that simulates what happens when Amazon Textract returns a "LimitExceededException".
Figured this out in https://github.com/simonw/simonwillisonblog/issues/132 - I was running PostgreSQL 9.x and I wanted 11.x in order to use the new option in Django 3.1.
llama.cpp recently added the ability to control the output of any model using a grammar. This is an incredibly powerful technique for working with a Large Language Model.
I had to run this site on for 24 hours due to a domain registration mistake I made. Once I got working again I wanted to permanently redirect the URLs on the temporary site to their equivalent on the…
When building the –sniff option for (which attempts to detect the correct CSV delimiter and quote character by looking at the first 2048 bytes of a CSV file) I had the need to peek ahead in an…
I wanted to make a small customization to one of my documentation templates on Read the Docs. It turns out you can over-ride the default templates by creating a directory in your documentation folder…
The code is in simonw/prompts-js on GitHub. The NPM package is prompts-js. A simple single file client-side package For this project, I wanted to create an old-fashioned JavaScript file that you could…
For paginate-json I wanted to implement streaming output of an indented JSON array to my terminal. The final output should look like this: But I needed this to work for an arbitrarily long sequence of…
I used the new GitHub Code Search to figure out how to do this. I searched for: 3.11 path:workflows/ .yml And found this example from which showed that the version tag to use is: 3.11-dev Update 28th…