Experiment registry: Can I simply enjoy everything I do?

N.B.: If I link you to this personally, it is to explain why I usually seem to be in a great mood. It’s an experiment. I’m normally in merely a good mood, and I am pushing myself to be great. This is an unusual entry for a Today I Learned site, even by my standards. But I think it’s something I would prefer to pre-register ahead of time. I’ve always been predisposed to mirth. I laugh easily; I rarely get depressed; I’m just about always in a content mood these days, in no small part because I have actually succeeded on the meager goals I set for myself as a teenager (soulmate: check, child: check, sujuvuus vieraalla kielellä: yhä työn alla mutta kyllä se siitä, give me maybe five more years). Yet for some reason I have always felt it is, I don’t know, low status to be so effortlessly joyful and opulent. Like people will take you less seriously or something. So I’ve been reluctant to push my naturally good mood into the realm of actively loving life as my default state. ...

July 7, 2025

Save your disk, write files directly into RAM with /dev/shm

Given my interest in extending the life of my SD cards and hard drives as much as possible, I’m surprised I haven’t come across /dev/shm before. In a word it’s a world-accessible RAM scratchpad, which seems baked right into POSIX, so that virtually every Unix EDIT: Linux system already has it mounted as a tmpfs by default: 1 2 ❯ mount | grep '/dev/shm' tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64) Today’s lucky 10,000, indeed. It gets mentioned often in Hacker News comments, but surprisingly I couldn’t find any actual articles talking about it. The existence of /dev/shm is a boon for me mostly because it means I never have to worry about whether /tmp is really RAM-based again. ...

June 26, 2025

Create multi-stage Anki card answers with HTML's <details> tag

This works as of, at least, Anki 24.06.3. According to the Mozilla Developer Network, The <details> HTML element creates a disclosure widget in which information is visible only when the widget is toggled into an open state. In standard web browsers, absent any CSS to the contrary, a <details> tag starts closed until further notice. Since Anki is basically a local web browser on top of a timer, this also works there. ...

June 7, 2025

Binary search isn't about search II. Loop invariant of leftmost element search

In the first “Binary search isn’t about search” post, we spoke about using assert statements to enforce your loop invariants. Our plain old everyday binary search invariant can be summarized as such: For all x in L[0:l]1, x is strictly less than T, the element we are searching for. For all y in L[r:len(L)]2, y is strictly greater than T, the element we are searching for. Or, if we want to be even terser, we could note this as simply ...

March 8, 2025

Binary search isn't about search

Suppose you’re trying to track down a bug that appeared in a series of Git commits. You’ve been idly keeping track of where this bug appears in your lucky commits by hand, while busy with other things. So far you’ve compiled this table: 1 2 3 4 5 6 7 8 9 10 0000000 🧼 clean, no bug. 0000001 🧼 0000002 🧼 0000003 🧼 0000004 🧼 0000005 🧼 0000006 🐛 bug first appears here. 0000007 🐛 0000008 🐛 0000009 🤔 bug mysteriously disappears... Then an EMP explodes in your vicinity and scrambles your memory circuits. The Internet is down, you don’t have the git-bisect man pages downloaded locally, and all you remember is that your first commit was good, your last commit was good but for reasons you don’t understand, and something bad is probably still lurking in there. But where? ...

March 7, 2025

`python -m http.server` as ephemeral Dropbox

Ever need to download a file from a server – or get someone else to download a file from a server, who may not be comfortable with or should have access to scp or sftp? Turns out, if you have Python installed – and you probably do – it comes with a handy one-liner file server for just such an occasion: 1 python -m http.server 12345 # or whatever port you prefer ...

January 21, 2025