Notes on software engineering

Archive / page 15

281–300 of 546 posts, newest first.

  1. 2024
  2. Implementing a "copy to clipboard" button

    I had to figure this out while building datasette-copyable - demo here. The trick is to run to copy to the clipboard - but only after first ensuring that some selectable content (probably in a…

    1 min read
  3. Quickly testing code in a different Python version using pyenv

    I had a bug that was only showing up in CI against Python 3.8. I used the following pattern with pyenv to quickly run the tests against that specific version.

    1 min read
  4. Limited JSON API for Google searches using Programmable Search Engine

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

    2 min read
  5. Start a server in a subprocess during a pytest session

    I wanted to start an actual server process, run it for the duration of my pytest session and shut it down at the end. Here's the recipe I came up with.

    1 min read
  6. Using async/await in JavaScript in Selenium

    Thanks Stuart Langridge for showing me how to do this:

    1 min read
  7. Using OpenAI functions and their Python library for data extraction

    Here's the pattern I figured out for using the openai Python library to extract structured data from text using a single call to the model.

    2 min read
  8. Using Prettier to check JavaScript code style in GitHub Actions

    I decided to adopt Prettier as the JavaScript code style for Datasette, based on my success with Black for Python code.

    1 min read
  9. Installing packages from Debian unstable in a Docker image based on stable

    For Datasette 1249 I wanted to build a Docker image from the base image ("buster" is the current stable release of Debian) but include a single package from "sid", the unstable Debian distribution.

    1 min read
  10. Redirecting all paths on a Vercel instance

    I wanted to redirect all traffic to to a different domain - preserving the path and the querystring and serving a 301 status code.

    1 min read
  11. Testing different Python versions with uv with-editable and uv-test

    A quick recipe I figured out today, for running the tests for a project against multiple Python versions. The key command option is .

    1 min read
  12. Migrating a GitHub wiki from one repository to another

    I figured out how to migrate a GitHub wiki (public or private) from one repository to another while preserving all history. The trick is that GitHub wikis are just Git repositories.

    1 min read
  13. Processing a stream of chunks of JSON with ijson

    A follow-up to Using OpenAI functions and their Python library for data extraction and Using the ChatGPT streaming API from Python.

    1 min read
  14. Upgrading packages with npm

    There's a new version of Vite out (3.0) and I wanted to upgrade my datasette-table package to use it. I mainly followed the guide on Update all the Node.js dependencies to their latest version to work…

    1 min read
  15. Registering the same Pluggy hook multiple times in a single file

    I found myself wanting to register more than one instance of a Pluggy plugin hook inside a single module. Hooks are usually registered like this: Where matches the name of a registered plugin hook.

    1 min read
  16. Running cog automatically against GitHub pull requests

    I really like Cog (previously) as a tool for automating aspects of my Python project documentation - things like the SQL schemas shown on the LLM logging page.

    1 min read
  17. Safely outputting JSON

    Carelessly including the output of in an HTML page can lead to an XSS hole, thanks to the following: Jinja has a function that avoids this in - the (simplified) implementation looks like this: Which…

    1 min read
  18. Livestreaming a community election event on YouTube

    I live in El Granada, California. Wikipedia calls us a census designated place - we don't have a mayor or city council.

    4 min read
  19. Registering temporary pluggy plugins inside tests

    While implementing more finely-grained permissions for (issue 8) I decided I wanted to register a Datasette pluggy plugin for the duration of a single test.

    1 min read
  20. Summarizing Hacker News discussion themes with Claude and LLM

    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.

    8 min read
  21. Trick Apple Photos into letting you access your video files

    I had an 11GB movie in Apple Photos (sync'd from my iPhone) and I wanted to upload it to YouTube (actually via AirDrop to another laptop first).

    1 min read