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.
Notes on software engineering
121–140 of 546 posts, newest first.
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.
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.
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…
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…
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…
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…
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.
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?
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.
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.
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…
Facebook's musicgen is a model that generates snippets of audio from a text description - it's effectively a Stable Diffusion for music.
Facebook's musicgen is a model that generates snippets of audio from a text description - it's effectively a Stable Diffusion for music.
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.
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…
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…
Flash cards are amazing way to learn advanced topics. Spaced repetition techniques are quite powerful and play well with how our brains work.
I found an MP3 recording of an old talk I gave and decided to use the slides from that talk to create a video using iMovie.
My csvs-to-sqlite README includes a section that shows the output of the command (relevant issue). I had been manually copying this in, but I decided to try using cog to automate the process.
I just spent way too long messing around with ChatGPT (transcript here) trying to figure this out. After much iteration, here's a recipe that works (mostly written by me at this point): The output…