Simon Willison’s Weblog

Subscribe

TILs

Filters: Sorted by date

TIL Mocking Stripe signature checks in a pytest fixture — I'm writing some code that accepts webhooks from Stripe. I wanted to simulate hits to this endpoint in my Django tests. Stripe uses a `Stripe-Signature` header and I wanted a way to mock my code so that I didn't need to calculate the correct signature.
None
TIL Running Prettier against Django or Jinja templates — I really like auto-formatting tools like Black. I've been hoping to find one that works with Django and Jinja templates for years.
None
TIL Upgrade Postgres.app on macOS — I've been using [Postgres.app](https://postgresapp.com/) to run PostgreSQL on my Mac for years. I like that it's easy to install, gives me a task tray icon to control it and means I don't have to run a full Docker environment just to hack on projects like [my blog](https://github.com/simonw/simonwillisonblog).
None
TIL Cloudflare redirect rules with dynamic expressions — I wanted to ensure `https://niche-museums.com/` would redirect to `https://www.niche-museums.com/` - including any path - using Cloudflare.
None
TIL Listen to a web page in Mobile Safari — I found a better way to listen to a whole web page through text-to-speech on Mobile Safari today.
None
TIL How I studied for my Ham radio general exam — I scraped a pass on my Ham radio general exam today, on the second attempt (you can retake on the same day for an extra $15, thankfully).
None
TIL Transcribing MP3s with whisper-cpp on macOS — I asked [on Twitter](https://twitter.com/simonw/status/1783520794754318600) for tips about running Whisper transcriptions in the CLI on my Mac. Werner Robitza [pointed me](https://twitter.com/slhck/status/1783556354487034146) to Homebrew's [whisper-cpp](https://formulae.brew.sh/formula/whisper-cpp) formula, and when I complained that it didn't have quite enough documentation for me to know how to use it [Werner got a PR accepted](https://github.com/Homebrew/homebrew-core/pull/170148) adding…
None
TIL A script to capture frames from a QuickTime video — I was putting together some notes for a talk I gave, and I wanted an efficient way to create screenshots of specific moments in a video of that talk.
None
TIL impaste: pasting images to piped commands on macOS — I wanted the ability to paste the image on my clipboard into a command in the macOS terminal.
None
TIL Installing tools written in Go — Today I learned how to install tools from GitHub that are written in Go, using [github.com/icholy/semgrepx](https://github.com/icholy/semgrepx) as an example:
None
TIL Google Chrome --headless mode — In the README for [monolith](https://github.com/Y2Z/monolith) (a new Rust CLI tool for archiving HTML pages along with their images and assets) I spotted this tip for using Chrome in headless mode to execute JavaScript and output the resulting DOM:
None
TIL Reviewing your history of public GitHub repositories using ClickHouse — There's a story going around at the moment that people have found code from their private GitHub repositories in the AI training data known as The Stack, using this search tool: https://huggingface.co/spaces/bigcode/in-the-stack
None
TIL Running self-hosted QuickJS in a browser — I want to try using [QuickJS](https://bellard.org/quickjs/) compiled to WebAssembly in a browser as a way of executing untrusted user-provided JavaScript in a sandbox.
None
TIL Programmatically comparing Python version strings — I found myself wanting to compare the version numbers `0.63.1`, `1.0` and the `1.0a13` in Python code, in order to mark a `pytest` test as skipped if the installed version of Datasette was pre-1.0.
None
TIL Redirecting a whole domain with Cloudflare — I had to run this site on `til.simonwillison.org` for 24 hours due to a domain registration mistake I made.
None
TIL Generating URLs to a Gmail compose window — I wanted to send out a small batch of follow-up emails for workshop attendees today, and I realized that since I have their emails in a database table I might be able to semi-automate the process.
None
TIL Using packages from JSR with esbuild — [JSR](https://jsr.io/) is a brand new package repository for "modern JavaScript and TypeScript", [launched on March 1st](https://deno.com/blog/jsr_open_beta) by the Deno team as a new alternative to [npm](https://www.npmjs.com/)
None
TIL Tracking SQLite table history using a JSON audit log — I continue to collect ways of tracking the history of a table of data stored in SQLite - see [sqlite-history](https://simonwillison.net/2023/Apr/15/sqlite-history/) for previous experiments.
None
TIL Running a scheduled function on Val Town to import Atom feeds into Datasette Cloud — [Val Town](https://www.val.town/) is a neat service for hosting short server-side JavaScript programs online - reminiscent of a combination of Glitch and Observable Notebooks.
None
TIL Getting Python MD5 to work with FIPS systems — [This issue](https://github.com/simonw/datasette/issues/2270) by Parand Darugar pointed out that Datasette doesn't currently run on Linux systems with FIPS enabled, due to the way it uses MD5 hashes.
None
TIL Running Ethernet over existing coaxial cable — I recently noticed that the router in our garage was providing around 900 Mbps if I plugged my laptop directly into it via an Ethernet cable, but that speed fell to around 80Mbps (less than 1/10th that speed) elsewhere in our house.
None
TIL Piping from rg to llm to answer questions about code — Here's a trick I've used a couple of times in the past few days.
None
TIL Creating GitHub repository labels with an Actions workflow — Newly created GitHub repositories come with a default set of labels. I have several labels I like to add on top of these. The most important is **research**, which I use for issues that are tracking my notes on a research topic relevant to the repository.
None
TIL Exploring ColBERT with RAGatouille — I've been trying to get my head around [ColBERT](https://github.com/stanford-futuredata/ColBERT).
None
TIL Logging OpenAI API requests and responses using HTTPX — My [LLM](https://llm.datasette.io/) tool has a feature where you can set a `LLM_OPENAI_SHOW_RESPONSES` environment variable to see full debug level details of any HTTP requests it makes to the OpenAI APIs.
None
TIL Publish releases to PyPI from GitHub Actions without a password or token — I published a package to [PyPI](https://pypi.org) today using their [Trusted Publishers](https://docs.pypi.org/trusted-publishers/) mechanism for the first time.
None
TIL Using pprint() to print dictionaries while preserving their key order — While parsing a CSV file using `csv.DictReader` today I noticed the following surprising result:
None
TIL Using expect() to wait for a selector to match multiple items — In the Playwright tests for [datasette-cluster-map](https://github.com/simonw/datasette-cluster-map) I wanted to assert that two markers had been displayed on a Leaflet map.
None
TIL literalinclude with markers for showing code in documentation — I [wanted to include](https://github.com/simonw/datasette/issues/1830) some example Python tests in the Datasette documentation - but since they were tests, I also wanted to execute them as part of my test suite to make sure they worked correctly.
None