til

320 posts tagged “til”.

  1. 2025
  2. Rate limiting by IP using Cloudflare's rate limiting rules

    Tailing the Heroku logs showed that it was getting a barrage of traffic to the page, which implements faceted search and hence has an almost unlimited set of possible combinations - and suchlike.

    1 min read
  3. Training nanoGPT entirely on content from my blog

    This is a follow-up to Running nanoGPT on a MacBook M2 to generate terrible Shakespeare. I used nanoGPT by Andrej Karpathy to train a GPT model entirely against content from my blog!

    4 min read
  4. Whisky sour

    I picked up the recipe for this one from this video by @notjustabartender on TikTok. Ingredients per drink - 1 egg white - 1/2 oz rich Demerara syrup (see below - needs Demerara sugar, water and a bit…

    1 min read
  5. Minifying JavaScript with npx uglify-js

    While upgrading CodeMirror in Datasette I figured out how to minify JavaScript using on the command line without first installing any teels, using npx (which downloads and executes a CLI tool while…

    1 min read
  6. Replicating SQLite with rqlite

    I tried out rqlite today, a "lightweight, distributed relational database, which uses SQLite as its storage engine".

    1 min read
  7. Running self-hosted QuickJS in a browser

    I want to try using QuickJS compiled to WebAssembly in a browser as a way of executing untrusted user-provided JavaScript in a sandbox. My plan is to host it locally, not load it from a CDN.

    1 min read
  8. Simple load testing with Locust

    I've been using Locust recently to run some load tests - most significantly these tests against SQLite running with Django and this test exercising Datasette and Gunicorn.

    1 min read
  9. Running tests against multiple versions of a Python dependency in GitHub Actions

    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.

    1 min read
  10. Lazy loading images in HTML

    Most modern browsers now include support for the image attribute, which causes images not to be loaded unti the user scrolls them into view.

    1 min read
  11. Using boto3 from the command line

    I found a useful pattern today for automating more complex AWS processes as pastable command line snippets, using Boto3.

    1 min read
  12. Manipulating query strings with URLSearchParams

    The class, in every modern browser since IE 11, provides a sensible API for manipulating query string parameters in JavaScript.

    1 min read
  13. macOS Catalina sort-of includes Python 3

    Once you have installed the "command line tools" for Catalina using the following terminal command: xcode-select –install will run Python 3.7.3: % which python3 /usr/bin/python3 % python3 Python 3.7.3…

    1 min read
  14. Serving a JavaScript project built using Vite from GitHub Pages

    I figured out how to serve a JavaScript project built using Vite using GitHub Pages and a custom build script that runs using GitHub Actions.

    2 min read
  15. Using the gcloud run services list command

    The command lists your services running on Google Cloud Run: It has two useful but under-documented options: which filters based on a special filter language, and which customizes the output format.

    1 min read
  16. Paginating through the GitHub GraphQL API with Python

    For my auto-updating personal README I needed to fetch the latest release for every repository I have on GitHub. Since I have 316 public repos I wanted the most efficent way possible to do this.

    1 min read
  17. Pausing traffic and retrying in Caddy

    A pattern I really like for zero-downtime deploys is the ability to "pause" HTTP traffic at the load balancer, such that incoming requests from browsers appear to take a few extra seconds to return…

    2 min read
  18. Syntax highlighting Python console examples with GFM

    It turns out GitHub Flavored Markdown can apply syntax highlighting to Python console examples, like this one: The trick is to use the following: pycon import csv with open('eggs.csv', newline='') as…

    1 min read
  19. 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. It turns out only works with textual data - so copying a portion of a screenshot to my clipboard (using…

    1 min read
  20. Trying out Quarto on macOS

    I decided to try out Quarto, the new notebook/markdown/publishing system built on Pandoc. I followed their Get started guide and downloaded and installed the macOS installer.

    1 min read
  21. Turning on Jinja autoescaping when using Template() directly

    Jinja autoescaping is turned off by default. Coming from Django this frequently catches me out. You can turn on autoescaping for your Jinja environment using: But what about if you are using directly?

    1 min read