Notes on software engineering

Archive / page 12

221–240 of 547 posts, newest first.

  1. 2024
  2. Tracing every executed Python statement

    Today I learned how to use the Python trace module to output every single executed line of Python code in a program - useful for figuring out exactly when a crash or infinite loop happens.

    1 min read
  3. Using nginx to proxy to a Unix domain socket

    I figured this out while adding support to Datasette in 1388. Save the following in : Start against that configuration file - this works without root provided you listen on a high port: nginx -c…

    1 min read
  4. Writing JavaScript that responds to media queries

    I needed to apply some changes to the DOM if the users window was smaller than 800px - or if the user resized their window to less than 800px after they had first loaded the page.

    1 min read
  5. get-graphql-schema

    The GraphQL schema language is a concise way to represent the available schema provided by a GraphQL endpoint.

    1 min read
  6. 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.

    1 min read
  7. Using git-filter-repo to set commit dates to author dates

    After rebasing a branch with 60+ commits onto I was disappointed to see that the commit dates on the commits (which are a different thing from the author dates) had all been reset to the same time.

    1 min read
  8. Using the sqlite3 Python module in Pyodide - Python WebAssembly

    Pyodide provides "Python with the scientific stack, compiled to WebAssembly" - it's an incredible project which lets you run a full working Jupyter notebook, complete with complex packages such as…

    1 min read
  9. Intercepting fetch in a service worker

    I'm learning service workers. I wanted to start with one that intercepts calls to a and returns "Hello World". Here's the initial recipe I came up with.

    1 min read
  10. Dynamically loading multiple assets with a callback

    For datasette-leaflet-geojson I wanted to dynamically load some external CSS and JavaScript and then execute some code once they had loaded (issue 14).

    1 min read
  11. Installing tools written in Go

    Today I learned how to install tools from GitHub that are written in Go, using github.com/icholy/semgrepx as an example: go install github.com/icholy/semgrepx@latest Running this command grabs a copy…

    1 min read
  12. Rewriting a repo to contain the history of just specific files

    I wanted to start a new git repository containing just the history of two specific files from my help-scraper repository.

    1 min read
  13. Upgrading a pipx application to an alpha version

    I wanted to upgrade my git-history installation to a new alpha version. doesn't work for that, because it upgrades to the most recent stable version - but I wanted the alpha.

    1 min read
  14. Using SQL with GDAL

    Inspired by Brad Neuberg I decided to take a look at the SQL features in the GDAL family of tools. GDAL is a complex beast.

    3 min read
  15. Constant-time comparison of strings in Node

    When comparing secrets, passwords etc it's important to use a constant-time compare function to avoid timing attacks. In Python I use , documented here. I needed an equivalent in Node.js today.

    1 min read
  16. Running pytest against a specific Python version with uv run

    While working on this issue I figured out a neat pattern for running the tests for my project locally against a specific Python version using uv run: The new-to-me trick here is that works for adding…

    1 min read
  17. Streaming indented output of a JSON array

    I wanted to produce the following output from a command-line tool: But I wanted to do it from a streaming iterator - without first buffering the entire output in an in-memory Python list and calling…

    1 min read
  18. Exploring ColBERT with RAGatouille

    I've been trying to get my head around ColBERT. ColBERT is a fast and accurate retrieval model, enabling scalable BERT-based search over large text collections in tens of milliseconds.

    5 min read
  19. Reusing an existing Click tool with register_commands

    The register commands plugin hook lets you add extra sub-commands to the CLI tool. I have a lot of existing tools that I'd like to also make available as plugins.

    1 min read
  20. Running a gpt-oss eval suite against LM Studio on a Mac

    OpenAI's gpt-oss models come with an eval suite, which is described in their Verifying gpt-oss implementations cookbook.

    5 min read
  21. Compressing an animated GIF with gifsicle or ImageMagick mogrify

    Using gifsicle Tip via Mark Norman Francis on Twitter: Saw your GIF size TIL, and gets it down to 320k.

    1 min read