A place for musings, observations, design notes, quick tips...
thought gists, if you like.
The Outsider by Albert Camus
Just finished The Outsider by Albert Camus (also known as The Stranger). Reading it felt like walking through an impressionist painting. Finishing it, one is left with a slightly blurred picture of a life — bleak yet nostalgic, emotionally distant yet resoundingly poignant.
One feels as much an Outsider to the book as the protagonist himself.
Some highlights:
- New word learnt: “lading”: put cargo onboard a ship
- Wine with lunch! How quintessentially French…
- Trams everywhere! A halcyon stalwart construction of bygone days
Despite the surrealism, everything feels strangely real - detached, yet vivid. The first-person voice and inner monologue makes everything feel in equal parts clear and blurry. I don’t know how much the various English translations differ, but this edition felt super crisp and readable. I was expecting it to be a more ponderous read, but the langauge was fresh and crisp.
Reading it in the autumn made me think
Existentialism is to falling leaves as a book is to trees — both are susurrations of impermanence; one traces the shedding of meaning, the other preserves. What is lost and what remains.
Structured outputs from LLMs
This is more of a “to-do” than anything, but I really love the idea of inference-time next-token probability-distribution hacking to enforce structured outputs. There’s this neat Python library outlines that I’d love to explore in more depth - it even supports context-free grammars for output guiding!
To uv or not to uv
uv
is a blazing fast Python package manager that aims to displace pip
. It’s a really slick tool that lets you go from git clone
to executing code with all the dependencies seamlessly. All the standard accolades apply: written in Rust, beautiful terminal UI, well thought-out user ergonomics … all written by Astral, the same company that gave the Python community ruff
.
But what makes it so damn fast? Under the rusty hood, the magic is even more impressive. Charlie Marsh, the project lead, presented at Jane Street and revealed some of the inner workings. The whole talk is super interesting, but some standout highlights are:
uv
has it’s own SAT solver implementation to resolve dependency package versions much faster than e.g.pip
orconda
. (@16:09
)- Interesting tricks around implementing efficient representations of dependency metadata in Rust data structures to allow super-fast solves. The team effectively wrote their own package version number parser and represented them cleverly inside a single
u64
to enable fast dependency comparisons as scalar integer comparisons. (@25:47
) - Some very clever usage of HTTP Range Requests to heuristically slice into compressed PyPi
.zip
package archives to parse package metadata from package registries, without having to retrieve the entire.zip
from PyPi first. (@31:42
) - A very clever cache design to enable super fast ephemeral Python venv creation, with some Rust zero-copy serialisation magic. (
@34:49
,@37:27
)
So, to uv
or not to uv
? I’d definitely give uv
a try - it really makes Python feel like magic.
Inverse UMAP transforms
TIL that the dimensionality reduction algorithm UMAP1 has support for inverse transforms!
Naturally, these are lossy inverses, but being able to generate novel examples of, for example, handwritten digits (yep, classic MNIST once again) is exceedingly cool.
The example images of handwritten digits here are sampled from the compressed planar space, and “inverted” into the original “image space”.
On a related note, the whole explanatory article for UMAP is a beautiful work of exposition, full of rich ideas that make one ponder deeply. I only wish I understood everything in here end-to-end.
Irregular Expressions
Someone at work asked if it’s possible to validate credit card numbers with the Luhn algorithm in regex.
Technically, a regular language could recognise valid fixed-length credit card numbers by brute-force enumerating all possible sequences. But as a more general solution, I don’t think DFAs can support the modular arithmetic required for arbitrary sequence lengths…
Possible or not, I feel incredibly nerd sniped.
Open uBanking
In Australia, we have the Consumer Data Right, a government mandated interoperability standard for the Banking (and now Energy) sector.
Also known as Open Banking, the idea is to ensure that banks expose APIs that allow safe access to your transactions history and account data without having to rely on hacky methods like screen scraping1.
Unfortunately, due to how the standard is enforced, it’s pretty tough to get access to your own transactions without going through an “approved data broker” that charges a premium for it (like Basiq), or a free app with limited export support like Frollo.
Well, if you’re a Ubank customer, it appears some genius has reverse-engineered the internal Ubank API from examining the API requests the frontend makes, and has exposed it as a Python-consumable API with Passkey authentication support. Genius.
As an aside, the API mentions Python “descriptors”, which I’d not heard of, but seems like an intriguing functionality worth exploring…
Surely you're `jq`ing
Today I read through the jq
manual cover-to-cover. For those unaware, jq
is a popular CLI tool to query and manipulate JSON. It’s also a Turing-complete mini-language with nice functional semantics that fits well into the ethos of composable CLI tools.
It was an exemplar of well-written technical documentation. Concise, well-written, littered with examples, and linking to an interactive playground to test-and-learn.
Some learnings:
- It’s surprisingly functional! You can implement recursive functions and use higher-order functions! For example, here’s factorial in
jq
:
$ jq '[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]'
- It supports string interpolation - this is really nice if you’re piping stuff from JSON into a string. Coupled with format strings this becomes frictionless:
$ echo '{"search":"hello; world"}' | jq -r '@uri "https://www.google.com/search?q=\(.search)"'
# https://www.google.com/search?q=hello%3B%20world
- You can define functions that accept functions1, and control structures that allow labelling.
$ echo '[[1,2],[10,20]]' | jq -r 'def addvalue(f): . + [f]; map(addvalue(.[0]))'
#[[1,2,1], [10,20,10]]
- You can traverse complex data structures with first-class pathing support. And you can easily modify nested structures to extend objects.
- For the category theorists/polyglots, there’s a denotational semantics paper written about
jq
. - Bonus: You can build a Brainfuck interpreter in
jq
; and you can build ajq
interpreter injq
- how’s that for bootstrapping!
Side note: This is one of my goals for 2025 - read through documentation end-to-end to develop mastery over tools. I’m trying to prioritise selectively depth over breadth.
-
The line between “functions” and “filters” is a little blurry to me. ↩︎
Shellshocked? Brace yourselves!
I just discovered that to capture multiple lines of stdout
from a shell script and redirect them to a file, you can simply wrap them in braces!
For example, my “Create a blog post via a GitHub Action triggered on an Issue creation” workflow uses this snippet:
{
echo "---"
jq 'del(.content)' "parsed_issue.json" | yq -P
echo "---"
echo ''
# Inline "content" key for the body
jq -r '.content' "parsed_issue.json"
} > content/micro-blog/"$FILENAME"
Typography in Parasite
This is awesome! Typographic Hangul from the title scene of Parasite
Developer Ergonomics
“I wonder how much it is insightful to watch someone doing a workflow and to note when discomfort kicks in. That’s a really insightful thing to realize what matters from bitter experience, right? … Experience tells you when to worry about something and when not to worry about it” - Ben Sparks
That is - the rising discomfort of a programmer when employing a new tool, framework, or library is a good window into the ergonomics of how one uses your tool, framework, or library. Source: How I animate 3Blue1Brown | A Manim demo with Ben Sparks. The whole video is worth checking out! It’s a masterclass on how to construct a programatic-animation library and demonstrate how to work within it.
When I get a chance, I’d love to unpack the source code for how sprite-to-sprite transforms (part of 3B1B’s signature look) and the vectorised rendering engine are implemented with OpenGL.
Audiolising SwiftUI Graphs
This demonstration of an auditory representation of a (visual) graph in Swift Charts is wild: Vectorized and function plots in Swift Charts at WWDC24.
Week 22
- I noted that there’s a difference between Anomaly detection and Outlier detection.
- Word of the week ~ enjambement
enjambement: (in verse) the continuation of a sentence without a pause beyond the end of a line, couplet, or stanza.
- As an aside, I find Rust as a language fiendishly complex at a first glance, and I’m amazed by people who find it so straightforward. Having said that, I’d much rather have lived in a universe where Rust was the first ’low-level’ language I learnt instead of C.
Week 21
- Discovered the concept of similarity graphs through a talk on Uniform Manifold Approximation and Projection (UMAP) for Dimension Reduction at SciPy 2018.
- Word of the week ~ grimoire, from French, an alteration of “grammaire” (grammar)
grimoire: a book of magic spells and invocations.
- Also, in the world of books: The Cossacks by Leo Tolstoy.