til

320 posts tagged “til”.

  1. 2023
  2. Linking from /latest/ to /stable/ on Read The Docs

    Read The Docs has a handy feature where documentation for older versions will automatically link to the latest release, for example on this page: That feature is enabled by a "Show version warning"…

    1 min read
  3. Running a MySQL server using Homebrew

    First, install MySQL like so: brew install mysql This installs the server but doesn't run it. You can run it in the background like this: Then later on you can stop it like so: While it's running it…

    1 min read
  4. Using expect() to wait for a selector to match multiple items

    In the Playwright tests for datasette-cluster-map I wanted to assert that two markers had been displayed on a Leaflet map.

    1 min read
  5. Running Python code in a subprocess with a time limit

    I figured out how to run a subprocess with a time limit for datasette-ripgrep, using the method. The pattern looks like this: For datasette-seaborn I wanted to render a chart using the Python seaborn…

    1 min read
  6. Tracking SQLite table history using a JSON audit log

    Today I decided to try a slightly different approach, using JSON to store changes to a table in an audit log.

    3 min read
  7. Very basic tsc usage

    I guess I have to learn TypeScript now. Here's how I got started in as few steps as possible, with the help of Get Started With Typescript in 2019 by Robert Cooper.

    2 min read
  8. Ordered group_concat() in SQLite

    I was trying to use to glue together some column values into a stiched together Markdown document. My first attempt looked like this: This attempt didn't work, because the order of the elements…

    1 min read
  9. Querying newline-delimited JSON logs using AWS Athena

    I've been writing my Fly logs to S3 in newline-delimited JSON format using the recipe described in Writing Fly logs to S3. I recently needed to run a search against those logs.

    2 min read
  10. Set environment variables for all steps in a GitHub Action

    From this example I learned that you can set environment variables such that they will be available in ALL jobs once at the top of a workflow: I had previously been using this much more verbose…

    1 min read
  11. Using uv to develop Python command-line applications

    I finally figured out a process that works for me for hacking on Python CLI utilities using uv to manage my development environment, thanks to a little bit of help from Charlie Marsh.

    3 min read
  12. Using pytest and Playwright to test a JavaScript web application

    I wrote the tests using playwright-pytest, which lets you write tests in Python using Microsoft's Playwright browser automation library.

    2 min read
  13. Preventing double form submissions with JavaScript

    I needed this for VIAL issue 722. I decided to disable form submissions for two seconds after they are submitted, to protect against accidental double submissions without risk of unexpected issues…

    1 min read
  14. Writing tests for the ASGI lifespan protocol with HTTPX

    Uvicorn silently ignores exceptions that occur during startup against the ASGI lifespan protocol - see starlette/issues/486.

    1 min read
  15. Running LLaMA 7B and 13B on a 64GB M2 MacBook Pro with llama.cpp

    Facebook's LLaMA is a "collection of foundation language models ranging from 7B to 65B parameters", released on February 24th 2023. It claims to be small enough to run on consumer hardware.

    4 min read
  16. Reviewing your history of public GitHub repositories using ClickHouse

    There's a story going around at the moment that people have found code from their private GitHub repositories in the AI training data known as The Stack, using this search tool…

    2 min read
  17. Updating a Markdown table of contents with a GitHub Action

    markdown-toc is a Node script that parses a Markdown file and generates a table of contents for it, based on the headings.

    1 min read
  18. Running OpenAI's large context models using llm

    OpenAI announced new models today. Of particular interest to me is the new model, which provides GPT 3.5 with a 16,000 token context window (up from 4,000) priced at 1/10th of GPT-4 - $0.003 per 1K…

    2 min read
  19. Unix timestamp in milliseconds in SQLite

    I wanted to retrieve the time in milliseconds since the Unix epoch in SQLite. Fetching seconds since the epoch is easy: Prior to SQLite 3.42.0 (released in May 2023) milliseconds were much more…

    2 min read
  20. Use labels on Cloud Run services for a billing breakdown

    Thanks to @glasnt for the tip on this one. If you want a per-service breakdown of pricing on your Google Cloud Run services within a project (each service is a different deployed application) the…

    1 min read
  21. Talking to a PostgreSQL service container from inside a Docker container

    I have a Django application which uses PostgreSQL. I build the Django application into its own Docker container, push that built container to the GitHub package registery and then deploy that…

    1 min read