Simon Willison’s Weblog

Subscribe

April 2022

70 posts: 5 entries, 15 links, 50 beats

April 17, 2022

None
TIL How to get credentials for a new Twitter bot — I wanted to build a Twitter bot that would tweet Covid sewage graphs from [this page](https://covid19.sccgov.org/dashboard-wastewater) every day.

April 18, 2022

Building a Covid sewage Twitter bot (and other weeknotes)

Visit Building a Covid sewage Twitter bot (and other weeknotes)

I built a new Twitter bot today: @covidsewage. It tweets a daily screenshot of the latest Covid sewage monitoring data published by Santa Clara county.

[... 1,079 words]

Release tweet-images 0.1.2 — Send tweets with images from the command line

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action. Ben Welsh’s writeup includes detailed step-by-step instructions for getting the mysterious “Workload Identity Federation” mechanism to work with GitHub Actions and Google Cloud. I’ve been dragging my heels on figuring this out for quite a while, so it’s great to see the steps described at this level of detail.

# 3:41 am / github, google, docker, ben-welsh

Release shot-scraper 0.13 — A command-line utility for taking automated screenshots of websites
Release asyncinject 0.4 — Run async workflows using pytest-fixtures-style dependency injection

April 19, 2022

Sighting 7:19 AM – 9:08 AM — Great Blue Heron, Pacific Sea Nettle, Sea Palm, California Spiny Chiton, Pink Volcano Barnacle, Pacific Harbor Seal, Ochre Sea Star, Elegant Aeolid, Red-winged Blackbird, in San Mateo County, CA, US
Great Blue Heron
Great Blue Heron
Pacific Sea Nettle
Pacific Sea Nettle
Sea Palm
Sea Palm
California Spiny Chiton
California Spiny Chiton
Pink Volcano Barnacle
Pink Volcano Barnacle
Pacific Harbor Seal
Pacific Harbor Seal
Ochre Sea Star
Ochre Sea Star
Elegant Aeolid
Elegant Aeolid
Elegant Aeolid
Elegant Aeolid
Red-winged Blackbird
Red-winged Blackbird

Netlify Edge Functions: A new serverless runtime powered by Deno. You can now run Deno scripts directly in Netlify’s edge CDN—bundled as part of their default pricing plan. Interesting that they decided to host it on Deno’s Deno Deploy infrastructure. The hello world example is pleasingly succinct:

export default () => new Response(“Hello world”)

# 4:46 pm / serverless, deno

Glue code to quickly copy data from one Postgres table to another (via) The Python script that Retool used to migrate 4TB of data between two PostgreSQL databases. I find the structure of this script really interesting—it uses Python to spin up a queue full of ID ranges to be transferred and then starts some threads, but then each thread shells out to a command that runs “psql COPY (SELECT ...) TO STDOUT” and pipes the result to “psql COPY xxx FROM STDIN”. Clearly this works really well (“saturate the database’s hardware capacity” according to a comment on HN), and neatly sidesteps any issues with Python’s GIL.

# 4:57 pm / postgresql, python

Sighting 3:06 PM – 3:22 PM — California Brown Pelican, Great Blue Heron, in Monterey Bay National Marine Sanctuary, CA, US, CA
California Brown Pelican
California Brown Pelican
California Brown Pelican
California Brown Pelican
Great Blue Heron
Great Blue Heron
Great Blue Heron
Great Blue Heron

April 20, 2022

Release django-sql-dashboard 1.1 — Django app for building dashboards using raw SQL queries
Sighting 10:31 AM – 10:42 AM — Snowy Egret, Red-winged Blackbird, in San Mateo County, CA, US
Snowy Egret
Snowy Egret
Red-winged Blackbird
Red-winged Blackbird
Red-winged Blackbird
Red-winged Blackbird

April 21, 2022

Web Components as Progressive Enhancement (via) I think this is a key aspect of Web Components I had been missing: since they default to rendering their contents, you can use them as a wrapper around regular HTML elements that can then be progressively enhanced once the JavaScript has loaded.

# 9:33 pm / web-components

April 22, 2022

Release asyncinject 0.5 — Run async workflows using pytest-fixtures-style dependency injection

April 24, 2022

Useful tricks with pip install URL and GitHub

Visit Useful tricks with pip install URL and GitHub

The pip install command can accept a URL to a zip file or tarball. GitHub provides URLs that can create a zip file of any branch, tag or commit in any repository. Combining these is a really useful trick for maintaining Python packages.

[... 929 words]

None
TIL Format code examples in documentation with blacken-docs — I decided to enforce that all code examples in the [Datasette documentation](https://docs.datasette.io/) be formatted using [Black](https://github.com/psf/black). Here's [issue 1718](https://github.com/simonw/datasette/issues/1718) where I researched the options for doing this.
Sighting 11:29 AM — California Brown Pelican, in Monterey Bay National Marine Sanctuary, CA, US, CA
California Brown Pelican
California Brown Pelican
California Brown Pelican
California Brown Pelican

WebAIM guide to using iOS VoiceOver to evaluate web accessibility (via) I asked for pointers on learning to use VoiceOver on my iPhone for accessibility testing today and Matt Hobbs pointed me to this tutorial from the WebAIM group at Utah State University.

# 7:35 pm / accessibility, screen-readers, ios

Sighting 3:40 PM — Northern Flicker, in San Mateo County, CA, US
Northern Flicker
Northern Flicker

April 26, 2022

A tiny CI system (via) Christian Ştefănescu shares a recipe for building a tiny self-hosted CI system using Git and Redis. A post-receive hook runs when a commit is pushed to the repo and uses redis-cli to push jobs to a list. Then a separate bash script runs a loop with a blocking “redis-cli blpop jobs” operation which waits for new jobs and then executes the CI job as a shell script.

# 3:39 pm / bash, continuous-integration, git, redis

None
TIL Seeing files opened by a process using opensnoop — I decided to try out [atuin](https://github.com/ellie/atuin?utm_source=tldrnewsletter), a shell extension that writes your history to a SQLite database.
None
TIL Atuin for zsh shell history in SQLite — [Atuin](https://github.com/ellie/atuin) (via [Rhet Turnbull](https://twitter.com/RhetTurnbull/status/1518942324004319232)) "replaces your existing shell history with a SQLite database". Obviously I had to try this out!

jq language description (via) I love jq but I’ve always found it difficult to remember how to use it, and the manual hasn’t helped me as much as I would hope. It turns out the jq wiki on GitHub offers an alternative, more detailed description of the language which fits the way my brain works a lot better.

# 7:04 pm / documentation, programming-languages, jq

Learn Go with tests. I really like this approach to learning a new language: start by learning to write tests (which gets you through hello world, environment setup and test running right from the beginning) and use them to explore the language. I also really like how modern Go development no longer depends on the GOPATH, which I always found really confusing.

# 7:12 pm / go

Mac OS 8 emulated in WebAssembly (via) Absolutely incredible project by Mihai Parparita. This is a full, working copy of Mac OS 8 (from 1997) running in your browser via WebAssembly—and it’s fully loaded with games and applications too. I played with Photoshop 3.0 and Civilization and there’s so much more on there to explore too—I finally get to try out HyperCard!

# 7:16 pm / computer-history, mac, mihai-parparita, webassembly

HTML event handler attributes: down the rabbit hole (via) onclick="myfunction(event)" is an idiom for passing the click event to a function - but how does it work? It turns out the answer is buried deep in the HTML spec - the browser wraps that string of code in a function(event) { ... that string ... } function and makes the event available to its local scope that way.

# 8:35 pm / dom-scripting, html, javascript

Release datasette-total-page-time 0.1 — Add a note to the Datasette footer measuring the total page load time

April 27, 2022

Release datasette-gzip 0.1 — Add gzip compression to Datasette

Weeknotes: Parallel SQL queries for Datasette, plus some middleware tricks

Visit Weeknotes: Parallel SQL queries for Datasette, plus some middleware tricks

A promising new performance optimization for Datasette, plus new datasette-gzip and datasette-total-page-time plugins.

[... 1,534 words]

April 28, 2022

Release asgi-gzip 0.1 — gzip middleware for ASGI applications, extracted from Starlette

2022 » April

MTWTFSS
    123
45678910
11121314151617
18192021222324
252627282930