Notes on software engineering

Archive / page 16

301–320 of 546 posts, newest first.

  1. 2024
  2. Dropdown menu with details summary

    I added dropdown menus to Datasette 0.51 - see 1064. I implemented them using the HTML element. The HTML looked like this: See the top right corner of https://latest-with-plugins.datasette.io/ for a…

    1 min read
  3. Useful Markdown extensions in Python

    I wanted to render some markdown in Python but with the following extra features: - URLize any bare URLs in the content, like GFM - Handle python from mdx urlize import UrlizeExtension import markdown…

    1 min read
  4. Enabling WAL mode for SQLite database files

    I was getting occasional messages from a Datasette instance that was running against a bunch of different SQLite files that were updated by cron scripts (my personal Dogsheep).

    1 min read
  5. Error 153 Video player configuration error on YouTube embeds

    In all cases the HTML looked something like this: It turned out the solution may be to replace with : (Weirdly on some refreshes of the page I get the same error. I'm not sure why that is.)

    1 min read
  6. Named Entity Resolution with dslim/distilbert-NER

    I was exploring the original BERT model from 2018, which is mainly useful if you fine-tune a model on top of it for a specific task. dslim/distilbert-NER by David S.

    1 min read
  7. Conditionally running a second job in a GitHub Actions workflow

    My simonwillisonblog-backup workflow periodically creates a JSON backup of my blog's PostgreSQL database, using db-to-sqlite and sqlite-diffable.

    1 min read
  8. Setting cache-control: max-age=31536000 with a Cloudflare Transform Rule

    I serve static assets for my blog (mainly images) from , which is an AWS S3 bucket served via Cloudflare.

    1 min read
  9. The pdb interact command

    Today Carlton told me about the interact command in the Python debugger. Here's how to use it with (but it works anywhere else where you find yourself in a session).

    1 min read
  10. Using ChatGPT to write AppleScript

    I found a killer application for ChatGPT today: writing AppleScript! I've been stubbornly refusing to learn AppleScript for nearly twenty years at this point.

    1 min read
  11. Custom Jinja template tags with attributes

    I decided to implement a custom Jinja template block tag for my datasette-render-markdown plugin. I wanted the tag to work like this: A basic Jinja extension After some fiddling around with GitHub…

    2 min read
  12. Restricting SSH connections to devices within a Tailscale network

    I'm running an AWS Lightsail instance and I want to only be able to SSH to it from devices connected to my Tailscale network.

    1 min read
  13. Using grep to write tests in CI

    GitHub Actions workflows fail if any of the steps executes something that returns a non-zero exit code. Today I learned that returns a non-zero exit code if it fails to find any matches.

    1 min read
  14. Adding a CORS policy to an S3 bucket

    Amazon S3 buckets that are configured to work as public websites can support CORS, allowing assets such as JavaScript modules to be loaded by JavaScript running on other domains.

    2 min read
  15. Sort by number of JSON intersections

    This post on Reddit asked how to run a query that takes a list of items (in this case ingredients) as the input and returns all rows with at least one of those items in a JSON list, ordered by the…

    1 min read
  16. Running pip install -e .[test] in zsh on macOS Catalina

    macOS Catalina uses rather than as the default shell (apparently because Apple don't like GPL 3). I usually set up my Python projects for development like this: datasette % pipenv shell Launching…

    1 min read
  17. Seeing files opened by a process using opensnoop

    I decided to try out atuin, a shell extension that writes your history to a SQLite database. It's really neat.

    1 min read
  18. Using Tesseract.js to OCR every image on a page

    Pasting this code into a DevTools console should load Tesseract.js from a CDN, loop through every image loaded by that page (every PNG, GIF, JPG or JPEG), run OCR on them and output the result to the…

    1 min read
  19. RAFT Consensus Explained

    RAFT Consensus Explained Originally I wrote it here In this article, we delve into the realm of consensus algorithms, essential components in distributed systems for achieving consensus among a…

    6 min read
  20. Calculating the AQI based on the Purple Air API for a sensor

    Purple Air sensors have an API at , which returns JSON that looks something like this: There's just one problem with this: it doesn't give you the AQI number that is displayed on their site!

    1 min read
  21. Mocking subprocess with pytest-subprocess

    For apple-notes-to-sqlite I needed to write some tests that simulated executing the command using the Python module. I wanted my tests to run on Linux CI machines, where that command would not exist.

    1 min read