RSSAmplifier

Blog

Alan Grow's Blog

alangrow.comRSS feed ↗27 posts

Latest posts

Rose Tinted Classes: An SVG Filter Function CSS Trick

In this post, we'll use CSS and SVG filter functions to tint an element's content Rose Quartz, Pantone's 2016 Color of the Year . The exact hex triplet for Rose Quartz is probably a trade secret, so I'll be using and praying I don't get sued by Big Color. Here's the content we're trying to rose tint: Homesteading in Pie Town Faro and Doris Caudill, homesteaders, Pie Town, New Mexico. Faro and…

Mental Models and Potemkin Understanding in LLMs

When you count 'one, two, three...' what's actually happening in your head? Maybe you see or hear something. Does your best friend use that same mental model? Now what about an LLM? (What's that you say, your best friend is an LLM? Pardon me for assuming!) Let Me Count the Ways to Count During grad school Feynman went through an obsessive counting phase . At first, he was curious whether he could…

Fast Filewise Git Blame

When was each file in a git repository last changed, and who changed it? Here's a one liner shell script that produces a fast filewise git blame report: #!/bin/sh TZ = UTC git log --name-status --date = iso-strict-local --pretty = "%ad%x09%ae" " $@ " | perl -F '/\t/' -lane ' if (/^[ACDMRTUXB]/) { $path = @F>2 ? $F[2] : $F[1]; print "$date\t$email\t$path" if -e "$path"; } elsif (@F) { ($date,…

Qmail with a Let's Encrypt SSL Cert

After a long hiatus, I am once again running a mailserver. Are You Crazy? It's 2024 A lot of us nerds got lazy and switched to hosted gmail about a decade ago. This consolidation has gradually corrupted some of our email ecosystem norms, and I think it's important to push back on that. But it's also important to have an email that's fully under your control, even if you only use it as the recovery…

What Letter-Pair Tileset Forms the Most Words?

While building a word game , Daniel Feldman ran into a problem that nerdsniped me instantly: what choice of twenty letter-pair tiles generates the most words? A number of approaches were proposed in the ensuing thread , with some folks even wondering if the problem might be NP-complete. In this post I'll present a greedy algorithm that's linear in the dictionary size and quadratic in the squared…

Music To Program To

Programming is deep work. Tuning out distractions is key, and music is one of the most effective tools at your disposal. But not all music helps you program. Music with lyrics can interfere with your ability to read and write code. Music with too many surprises can add rather than remove distraction. After some experimentation, many programmers arrive at the same conclusion: repetitive electronic…

Slippery Device Names and Portable AMIs

Pain, thy name is hotpluggable device name assignment. In the course of migrating some EC2 servers from C3 to C5, I learned why this feature in newer linux kernels is controversial. To be clear, most people couldn't care less whether their primary network interface is called eth0 or enx0150b6e42dfe , or whether a drive appears as /dev/xvda or /dev/nvme9n5 , as long as they can continue to do their…

Matrix Chat in the Terminal with weechat-matrix

I've been using the Element iOS App to chat with a few security-conscious friends. It works fine, but at some point you outgrow chatting with your thumbs, and long for the full ten-fingered chat experience. (A 5x improvement!!) Fortunately the Matrix protocol is an open standard with plenty of clients . I like terminal programs, and this Slack plugin for weechat has been a pleasant surprise of…

On Remote Work: An Interview

This interview originally appeared on remote.community in March 2020 . Hello! who are you and where do you work? Hello! I'm Alan Grow, co-founder at Endcrawl . We're a SaaS that makes credits for film & TV. We've been used on thousands of productions including Oscar Winners 'Moonlight' and 'Nomadland.' How did you get started working remotely? I first tried remote work back in 2006. It was a…

Shell Quirk: Assignment From a Heredoc

I have a fetish for fascination with POSIX shell corner cases. It all started a decade ago with a segfault: a certain while read loop ran fine on every Unix except AIX. We were stumped, and I was hooked. Here's a new find. What will the following POSIX shell program print? #!/bin/sh paths = ` tr '\n' ':' | sed -e 's/:$//' ` <<EOPATHS /foo /bar /baz EOPATHS echo " $paths " If you said…

Blog Refresh: Now With Less

To readers who enjoyed the 3-column layout, the Edgar Allen Poe quote, and the engraving of the fragile rowboat disappearing into the mighty maelstrom: I'm sorry. It's all gone. To me, minimalism is less an aesthetic than it is the search for time invariants, and well...here we are some years later. It's actually a bit more practical than all that. After porting this blog from jekyll to tinysite ,…

Dream Deploys: Atomic, Zero-Downtime Deployments

Are you afraid to deploy? Do deployments always mean either downtime, leaving your site in an inconsistent state for a while, or both? It doesn't have to be this way! Let's conquer our fear. Let's deploy whenever we damn well feel like it. This is a tiny demo to convince you that Dream Deploys are not only possible, they're easy. To live the dream, you don't need much: You don't need a fancy load…

Turn Vim Into Excel: Tips for Editing Tabular Data

Vim editing some 2010 US census data Vim can edit just about anything, including tabular data. This post has a few tips for making stock Vim more spreadsheet-like. We'll assume you're editing files in tab-separated value format (TSV). CSV is a notoriously thorny file format with plenty of edge cases and surprises, so if you have CSV files, it's simpler to sidestep all that and roundtrip CSV to TSV…

How to printf a length-delimited string

Sometimes you're dealing with a string that isn't null-delimited but rather length-delimited, and you wind up doing somersaults just to print it out: void logit ( const char * string , size_t length ) { char buf [ 255 ]; strncpy ( buf , string , sizeof ( buf )); buf [ sizeof ( buf ) - 1 ] = '\0' ; fprintf ( stderr , "debug: %s \n " , buf ); } The extra copying isn't necessary, and you don't have…

Recovering a Dying iPod Disk

An 80GB iPod Classic filled with 4 years of music started to die on us. The symptom: the menu screen suddenly showed 'No Music,' but disk usage was still nearly 100%. I figured this meant the internal 1.8' hard disk had started to go south and had taken some critical sectors with it. That turned out to be the case. But here's how we recovered nearly 10,000 files from the iPod anyway... The Winning…

How Many Consonant Pairs Do We Actually Use?

Of all possible consonant pairs, how many are actually used in the English language? The question came up at a party during a disappointing Ouija board session where the spirits conjured gibberish like 'QHPEV.' Someone wondered aloud how difficult it was to pick a valid pair of consonants at random. We suspected most were invalid. This is a nice little problem for the unix text processing toolset.…

Mutt Tip: Attach Multiple Files

You can attach multiple files in mutt 's file browser, if they're in the same directory: just use 't' to tag them, then ';'-Enter. (Quickly, one after the other.) You can also view files from the file browser before attaching them, just hit Space. Ten years of mutt and I'm still discovering this stuff...

PostgreSQL Tip: Bulk Copying Data Between Tables

Suppose you have two different PostgreSQL databases, db1 and db2. You want to populate db2.table2 with data from db1.table1. How? Try this: psql -c 'COPY table1 TO STDOUT' db1 | \ psql -c 'COPY table2 FROM STDIN' db2 Is there a more efficient way to do this if the two databases are hosted by the same server instance? Probably. Then again, if the databases are on different servers, this works: psql…

Measuring the Measurers

'Projects A and B are your top priority now. Oh, and Project C can't be impacted.' Sound familiar? It's a common complaint of the project-managed: everything can't be top priority. Something has to give. Resources allocated to Project A must be deallocated from elsewhere, either Project C, or some other project. Declaring everything 'top priority' is not helpful. If project management accomplishes…

Put *Everything* in vi Mode

If you're a vi user like me, try adding these two lines to your ~/.inputrc file: set keymap vi set editing-mode vi Now, every program that uses the readline library for tty input ( perl -d , the python REPL, psql , gdb , anything you run under rlwrap , etc.) has vi key bindings instead of the default emacs bindings. In short, this means things like: 0 and $ for beginning and end of line k and j…

How I Lost $100 and Blamed It On cal(1)

True story. Back in September 2008, I decided that this year, I would not wait until the last minute to book my Thanksgiving flight home. What's the rule for Thanksgiving again? Oh right, fourth Thursday in November. So I busted out cal(1) : $ cal September 2008 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Whoops, it only shows the current…

Teasing Out a New Git Repository

The Ideal Git Law states that the documentation surrounding git(1) will expand to fill all available volume. I'm building a suite of record processing tools. Up to now, the development has taken place inside the lwpb git repository. But it doesn't really belong there, since other record formats besides protobuf are supported: the classic unix tab-separated text format, and soon json. So how does…

Profiling every command in a Makefile

Here's the scenario. I've got a batch data processing pipeline implemented as a Makefile. (Hey! It's only a prototype! Trust me, I'm a make hater just like you!) There's already a lot of data, so an end-to-end full run can take about a day, with some of the individual stages taking hours. Now I'm thinking, wouldn't it be nice to know how long each rule took? Even better, wouldn't it be nice to get…

Bouncing, Hopping and Tunneling with tcpforward

This weekend I dusted off a little network utility of mine called tcpforward . It proved its worth once again, so instead of throwing it back into the rusty toolbox like I always do, here's why you might want to throw it into your very own rusty toolbox. ;) Scenario: Remote Assistance, AKA 'Bouncing Your Signal Off The Moon' Scenario: Hopping Over the Middleman Scenario: Tunneling Through…

Thinkpad T43 Key Removal, Assembly

Within a few days of the destruction of my T40 , I got a T43 from a guy on craigslist. The left control key promptly broke so I swapped it for the right one. There's relatively little info out there about how to assemble and disassemble keys, so here's some info on the process. Before we begin, get out your jeweler's eyepiece... You can pry off the key face gently as described here , just push…

TAI64 For All Time

From Bernstein's tai64 page : Integers 2^63 and larger are reserved for future extensions. Under many cosmological theories, the integers under 2^63 are adequate to cover the entire expected lifetime of the universe; in this case no extensions will be necessary. Phew! Dealing with multilog 's TAI64 timestamps is always a bit annoying, but I suppose old djb may very well be laughing his head off in…

Colorful Bash Prompt Generator

(A very old post, but I've used this prompt ever since.) Customizing a shell prompt often culminates in an impressive plumage display like export PS1 = '\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\n\[\e[0m\]$ ' the idea being that lots of escape sequences = eliteness. Though, I'd guess most people just copy someone else's bash prompt and foist it off as their own, rather than learn ansi / xterm /…