Notes on software engineering

Archive / page 7

121–140 of 550 posts, newest first.

  1. 2025
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. Embedding paragraphs from my blog with E5-large-v2

    Xeophon suggested that E5-large-v2 as an embedding model that was worth a closer look. It's an interesting model. It's trained to match queries against passages of text.

    6 min read
  8. 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
  9. 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
  10. Extracting web page content using Readability.js and shot-scraper

    Readability.js is "A standalone version of the readability library used for Firefox Reader View". I figured out how to use the two of these together to extract the core content from a web page using…

    1 min read
  11. 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
  12. 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
  13. 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
  14. Running Python code in a Pyodide sandbox via Deno

    I continue to seek a solution to the Python sandbox problem. I want to run an untrusted piece of Python code in a sandbox, with limits on memory and time.

    2 min read
  15. How to mock httpx using pytest-mock

    I wrote this test to exercise some httpx code today, using pytest-mock. The key was to use which patches the module that was imported by the module.

    1 min read
  16. Run Python code in a WebAssembly sandbox

    I've been trying to figure this out for ages. Tim Bart responded to my call for help on Hacker News with this extremely useful code example showing how to run Python code in WebAssembly inside Python…

    1 min read
  17. Trying out the facebook/musicgen-small sound generation model

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

    1 min read
  18. Trying out the facebook/musicgen-small sound generation model

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

    1 min read
  19. Using the Fly Docker registry

    Fly.io lets you deploy Docker containers that will be compiled as a Firecracker VM and run in locations around the world. Fly offer a number of ways to build and deploy apps.

    2 min read
  20. A simple two column CSS grid

    I decided to use CSS grids for this. I started with GPT-4. My prompt: HTML and CSS to display a grid of four images, each with a paragraph caption below the image - use figcaption The 2x2 grid should…

    2 min read
  21. Closest locations to a point

    Here's a PostgreSQL SQL query that returns the closest locations to a point, based on a brute-force approach where the database calculates the distance (in miles) to every single row and then sorts by…

    1 min read