Simon Willison: TIL

Things I've learned, collected in simonw/til. You may also enjoy my blog.

Atom feed

Browse by topic: ab 1 · amplitude 1 · asgi 1 · auth0 2 · aws 8 · awslambda 1 · azure 1 · bash 11 · caddy 1 · clickhouse 1 · cloudflare 1 · cloudrun 8 · cocktails 3 · cookiecutter 2 · cooking 1 · cosmopolitan 1 · css 1 · datasette 17 · deno 3 · digitalocean 1 · discord 1 · django 17 · docker 9 · duckdb 2 · electron 6 · exif 1 · firefox 1 · fly 8 · gis 3 · git 6 · github 15 · github-actions 24 · google 1 · google-sheets 1 · googlecloud 6 · gpt3 11 · graphql 3 · hacker-news 1 · heroku 3 · homebrew 6 · html 4 · http 1 · ics 1 · imagemagick 2 · javascript 15 · jinja 3 · jq 8 · json 3 · jupyter 1 · kubernetes 2 · linux 4 · llms 12 · machinelearning 1 · macos 19 · markdown 3 · mastodon 4 · mediawiki 1 · midjourney 1 · misc 1 · networking 1 · nginx 1 · node 1 · npm 3 · observable 1 · observable-plot 2 · overture-maps 1 · pixelmator 1 · pluggy 1 · postgresql 6 · presenting 1 · purpleair 1 · pypi 1 · pytest 19 · python 56 · quarto 1 · readthedocs 6 · reddit 1 · selenium 2 · service-workers 1 · shot-scraper 5 · spatialite 4 · sphinx 3 · sql 5 · sqlite 49 · svg 1 · tailscale 1 · tesseract 1 · twitter 3 · typescript 1 · vega 1 · vim 1 · vscode 2 · web-components 1 · webassembly 2 · webauthn 1 · wikipedia 1 · yaml 1 · zeit-now 2 · zsh 2

Recent TILs

css Understanding the CSS auto-resizing textarea trick - 2023-09-30

Chris Coyier wrote about the new form-sizing: normal property, which can get a <textarea> to automatically expand to fit its content - but currently only in Google Chrome Canary. Chris also linked to his own favourite trick for doing that, using some CSS grid trickery (original idea by Stephen Shaw). …

pytest Snapshot testing with Syrupy - 2023-09-26

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. …

sqlite Geospatial SQL queries in SQLite using TG, sqlite-tg and datasette-sqlite-tg - 2023-09-25

TG is an exciting new project in the world of open source geospatial libraries. It's a single C file (an amalgamation, similar to that provided by SQLite) which implements the subset of geospatial operations that I most frequently find myself needing: …

machinelearning Trying out the facebook/musicgen-small sound generation model - 2023-09-23

Facebook's musicgen is a model that generates snippets of audio from a text description - it's effectively a Stable Diffusion for music. …

google Limited JSON API for Google searches using Programmable Search Engine - 2023-09-16

I figured out how to use a JSON API to run a very limited Google search today in a legit, non-screen-scraper way. …

github-actions Running tests against multiple versions of a Python dependency in GitHub Actions - 2023-09-15

My datasette-export-notebook plugin worked fine in the stable release of Datasette, currently version 0.64.3, but failed in the Datasette 1.0 alphas. Here's the issue describing the problem. …

llms Using llama-cpp-python grammars to generate JSON - 2023-09-12

llama.cpp recently added the ability to control the output of any model using a grammar. …

sqlite Trying out cr-sqlite on macOS - 2023-09-12

cr-sqlite is fascinating. It's a loadable SQLite extension by Matt Wonlaw that "allows merging different SQLite databases together that have taken independent writes". …

llms Summarizing Hacker News discussion themes with Claude and LLM - 2023-09-09

I've been experimenting with the combination of Claude and my LLM CLI tool to give me quick summaries of long discussions on Hacker News. …

llms Embedding paragraphs from my blog with E5-large-v2 - 2023-09-08

Xeophon suggested that E5-large-v2 as an embedding model that was worth a closer look. …

datasette Running Datasette on Hugging Face Spaces - 2023-09-08

Julien Chaumond, this morning (replying to my tweet about my Hugging Face TheBloke model git scraper): …

datasette Remember to commit when using datasette.execute_write_fn() - 2023-08-31

I was writing some code for datasette-auth-tokens that used db.execute_write_fn() like this: …

json Streaming output of an indented JSON array - 2023-08-29

For paginate-json I wanted to implement streaming output of an indented JSON array to my terminal. …

macos Downloading partial YouTube videos with ffmpeg - 2023-08-26

I spoke at WordCamp US 2023, and wanted to grab a copy of the video of my talk. I always try to keep my own copies of these because I've seen some conferences eventually take these offline in the past. …

sqlite Compile and run a new SQLite version with the existing sqlite3 Python library on macOS - 2023-08-22

I've been trying to figure this out for years. Previous notes include Using LD_PRELOAD to run any version of SQLite with Python (Linux only), and Building a specific version of SQLite with pysqlite on macOS/Linux and Using pysqlite3 on macOS (both using the pysqlite3 package). But the dream was always to find a way to let me easily run a different SQLite version with the sqlite3 module from the Python standard library directly on my Mac. …

fly Configuring Django SQL Dashboard for Fly PostgreSQL - 2023-08-21

I have a Fly application that uses their PostgreSQL service. I wanted to run Django SQL Dashboard with a read-only user against that database. …

sqlite Calculating the size of a SQLite database file using SQL - 2023-08-21

I learned this trick today while browsing the code of Blacklite, a neat Java library for writing diagnostic logs to a SQLite database. …

readthedocs Updating stable docs in ReadTheDocs without pushing a release - 2023-08-20

I use ReadTheDocs for several of my projects. It's fantastic: among other things, it makes it easy to publish the documentation for my latest main branch at /latest/ and the documentation for my latest release at /stable/ (as well as maintain archived tag URLs for every prior release). …

bash A shell script for running Go one-liners - 2023-08-20

bitfield/script is a really neat Go project: it tries to emulate shell scripting using Go chaining primitives, so you can run code like this: …

sqlite A one-liner to output details of the current Python's SQLite - 2023-08-19

In investigating llm/issues/164 I found myself needing to know more precise details of the Python SQLite environment used by the reporter of the bug. …

python A simple pattern for inlining binary content in a Python script - 2023-08-19

For simonw/til issue #82 I needed to embed some binary content directly in a Python script. …

bash Running multiple servers in a single Bash script - 2023-08-16

I spotted this script that starts the opendream appication running both a Python uvicorn server and a npm run start script and it intrigued me - was it this easy to have a single Bash script run two servers? They were both started in the background with &, like this: …

json Processing a stream of chunks of JSON with ijson - 2023-08-15

A follow-up to Using OpenAI functions and their Python library for data extraction and Using the ChatGPT streaming API from Python. If I have a stream of chunks of a larger JSON document, how can I output full individual JSON objects as soon as they are available? …

django Building a blog in Django - 2023-08-15

We launched the Datasette Cloud blog today. The Datasette Cloud site itself is a Django app - it uses Django and PostgreSQL to manage accounts, teams and soon billing and payments, then launches dedicated containers running Datasette for each customer. …

llms Storing and serving related documents with openai-to-sqlite and embeddings - 2023-08-14

I decide to upgrade the related articles feature on my TILs site. Previously I calculated these using full-text search, but I wanted to try out a new trick using OpenAI embeddings for document similarity instead. …

jq Combined release notes from GitHub with jq and paginate-json - 2023-08-12

Matt Holt asked: …

cosmopolitan Catching up with the Cosmopolitan ecosystem - 2023-08-10

I caught up with some of the latest developments in the ecosystem around Justine Tunney's cosmopolitan and Actually Portable Executable (APE) projects this week. They are absolutely fascinating. …

github Running a Django and PostgreSQL development environment in GitHub Codespaces - 2023-08-10

Helping people setup development environments (and fix them when they break) can be incredibly frustrating. I'm really excited about cloud-based development environments such as GitHub Codespaces for exactly this reason - I love the idea that you can get a working environment by clicking a green button, and if it breaks you can throw it away and click the button again to get a brand new one. …

html Scroll to text fragments - 2023-08-08

I ran a Google search this morning for s3-credentials simon willison and when I clicked on the top result it jumped me to a highlighted snippet of text on the page, despite that page not having relevant anchor links. …

python Checking if something is callable or async callable in Python - 2023-08-04

I wanted a mechanism to check if a given Python object was "callable" - could be called like a function - or "async callable" - could be called using await obj(). …

Browse all 471 TILs