Evan Hahn's blog
https://evanhahn.com/blog/
My blog, mostly about programming.
フィード

Notes from October 2025
Evan Hahn's blog
Wow, another month gone by. Here are my notes.Things I publishedI’m not a PHP developer but I was invited to speak at Longhorn PHP, where I gave a talk about understanding Unicode. I’ve given a version of this talk before but it was fun to adapt it for a PHP crowd. Hopefully a recording will be posted soon.“Scripts I wrote that I use all the time” was a quickly-written summary of a bunch of scripts from my dotfiles. Little did I know that it would be my most popular post of all time (I think)! Lots of people reached out with their own useful scripts, it was highly upvoted on Lobsters and Hacker News, and it made it to a few newsletters. I should’ve known it would be popular because programmers love talking about dotfiles—even more than they like talking about AI.And, like every month, I wrote a few articles over at Zelda Dungeon.Greetings from fascismIt’s hard to pay attention to tech stuff when ICE is abducting my neighbors. For example, Block Club Chicago published this summary just
7日前

Scripts I wrote that I use all the time
Evan Hahn's blog
In my decade-plus of maintaining my dotfiles, I’ve written a lot of little shell scripts. Here’s a big list of my personal favorites.Clipboardcopy and pasta are simple wrappers around system clipboard managers, like pbcopy on macOS and xclip on Linux. I use these all the time.# High level examplesrun_some_command | copypasta > file_from_my_clipboard.txt# Copy a file's contentscopy < file.txt# Open a file path from your clipboardvim "$(pasta)"# Decode some base64 from the clipboardpasta | base64 --decodepastas prints the current state of your clipboard to stdout, and then whenever the clipboard changes, it prints the new version. I use this once a week or so.# High level examplepastas > everything_i_copied.txt# Download every link I copy to my clipboardpastas | wget -i -cpwd copies the current directory to the clipboard. Basically pwd | copy. I often use this when I’m in a directory and I want use that directory in another terminal tab; I copy it in one tab and cd to it in another. I us
16日前

Notes from September 2025
Evan Hahn's blog
Things I did and saw this September. See also: my notes from last month.Things I didI asked Ben Werdmuller for advice on “the best way for technologists to apply their skills to positive change”, and he gave a great answer. (I didn’t really do much here…all I did was ask the question.)“People read your blog in many different ways” was an attempt to capture the huge number of different types of readers you might have. I don’t know if this one is useful, but this kind of thinking is helpful for me.Following NetBSD, QEMU, and Gentoo, I updated Helmet.js’s guidelines to discourage AI contributions.I’ve long disliked @ts-ignore in TypeScript, so I published "@ts-ignore is almost always the worst option".In my effort to fill in the internet’s missing pieces, I posted a bit about JavaScript fetch’s character encoding. Hopefully I’ve helped the next person with this question.And as usual, I wrote a few articles for Zelda Dungeon this month. I’m happy the ZD editors let me get a little deranged
1ヶ月前

People read your blog in many different ways
Evan Hahn's blog
I read a lot of tech blog posts and have written a few of my own. I think a lot about the varied ways people read.How thoroughly do people read?Some readers read every word from start to finish. (I suspect this is rare.)Some readers skim.Some readers don’t read your post at all.How much of the language do they understand?Some readers read in a language they’re fluent in.Some readers read in a language they understand, but not fluently.Some readers read an automated translation because they don’t speak the language.Some readers have great vocabularies and understand when you use words like “synecdoche”.Some readers have smaller vocabularies and benefit from simpler words. (This is me.)What software are readers using to consume your post?Readers use varying screen sizes. Phones, laptops, tablets, maybe even refrigerators.Readers use varying font sizes. For example, I increase my display’s font size for readability.Some readers listen to your post with text-to-speech.Some readers use a “r
2ヶ月前

@ts-ignore is almost always the worst option
Evan Hahn's blog
In short: in TypeScript, any and @ts-expect-error are almost always better than @ts-ignore.Sometimes, I want to ignore a TypeScript error without doing a proper fix. Maybe I’m prototyping and don’t need perfect type safety. Maybe TypeScript isn’t smart enough to understand a necessary workaround. Or maybe I’m unable to figure out a solution because I’m not a TypeScript expert!In these moments, I’m be tempted to reach for a // @ts-ignore comment, which will suppress all errors on the following line. For example, this code will report no errors even though the type of foo is wrong:// @ts-ignoreconst foo: string = 123;This quick fix is even recommended by editors like Visual Studio Code, and seems like a reasonable solution when I just want something done quickly. But, in my opinion, @ts-ignore is almost never the best choice.Alternative 1: @ts-expect-error@ts-ignore has a sibling: @ts-expect-error.@ts-ignore tells TypeScript to ignore the next line. @ts-expect-error asks TypeScript to ig
2ヶ月前

JS fetch converts string request bodies to UTF-8
Evan Hahn's blog
In short: when a fetch request body is a string, the server will receive UTF-8 bytes.I was recently calling fetch with a string body, like this:await fetch("/foo", { method: "POST", body: "🍉",});I wondered: what exact bytes would the server receive? Most stuff uses UTF-8 nowadays, but JavaScript uses UTF-16 for its strings. So what would fetch send?Spec is inconclusive?Best I could tell, the Fetch specification doesn’t directly specify what should happen here. However, it links to another document that says the following:To get a byte sequence out of a string, using UTF-8 encode from Encoding is encouraged. In rare circumstances isomorphic encode might be needed.Sounds like UTF-8 is “encouraged”, but what actually happens in practice?A simple testI wrote a short Crystal web server that logged the bytes of an incoming request:require "http/server"def hex_dump(io : IO) : String io.getb_to_end.map(&.to_s(16).rjust(2, '0')).join(" ")endHTTP::Server.new do |context| body = context.request....
2ヶ月前

Notes from August 2025
Evan Hahn's blog
Things I published and things I saw this August.See also: my notes from last month, which has links to all the previous months so far.Things I published this monthMost of my work this month was on private stuff, like some contracting and a demo app for a small social group. But I published a few little things:Over on Zelda Dungeon, I wrote a big guide showing how to play every Zelda in 2025 and a deranged post about my favorite Ocarina of Time item.Got invited to speak at Longhorn PHP in October, giving a version of a Unicode talk I’ve given before. Spent some time prepping that.Speaking of Unicode, I added a new script, u+, to my dotfiles. Now I can run u+ 2025 to see ñ, LATIN SMALL LETTER N WITH TILDE. Thanks to Python’s unicodedata library for making it easy!I also wrote a quick script, csv2md, to convert CSV files to Markdown tables.Hopefully I’ll have more blog posts in September!Links and bookmarks and goodiesI started seeding some torrents of censored US government data. Cool pr
2ヶ月前

Notes from July 2025
Evan Hahn's blog
Here are some of my notes from July 2025. See also: my notes from last month, and the month before, and so on…What I published this July“How I build software quickly” was my marquee post this month. I haven’t mastered the tension between speed and quality, but I’ve learned a few things that have been useful. It sparked a lot of discussion on Lobsters and Hacker News. I worked on this post for months, and I’m glad it did well (for me, at least).I informally compared the download sizes of local LLMs with offline Wikipedia. Seems like Wikipedia offers more value per gigabyte. The Hacker News girlies were all over this one too, probably because it mentioned AI even a little.I wrote a simple macOS-only script to extract text from images. I can now run ocr image.png to grab text out of screenshots and photos, at least on macOS.I read Where Wizards Stay Up Late: The Origins of the Internet, a book about the invention of the internet, and took a few notes. I also took notes on The Weather Mach
3ヶ月前

Notes from "The Weather Machine: A Journey Inside the Forecast"
Evan Hahn's blog
In The Weather Machine: A Journey Inside the Forecast, author Andrew Blum gives a high-level overview of global weather forecasting. What complexity hides behind the simple interfaces of our daily weather apps?Three main points stuck out to me:“The weather machine has to be a global system, and it won’t work any other way.” International collaboration is critical. Weather models need lots of global data to be effective.Weather technology, like the internet, is closely tied to military interests. Some quotes:“In a very practical sense, there were few clear distinctions between weather satellites and reconnaissance satellites, or cargo-carrying rockets and intercontinental ballistic missiles. It worked both ways. The military uses justified the meteorological efforts. The military efforts benefited the meteorological uses.”The NASA Jet Propulsion Laboratory “was haunted by the space program’s fundamental duality: They would create the machines that would open up a new era in human explor
3ヶ月前

Notes from "Where Wizards Stay Up Late: The Origins of the Internet"
Evan Hahn's blog
Last month, I read Empire of AI, a scathing tale of the invention of ChatGPT. This month, I read Where Wizards Stay Up Late: The Origins of the Internet, a much rosier story of the invention of a more important technology: the internet.Authors Katie Hafner and Matthew Lyon cover the history starting in the 1960s all the way up to 1994, just two years before the book was published.1 Here are my notes.Chapter 1: The Fastest Million DollarsThis book argues that the space race was a precursor to the invention of the Internet, because it led to the creation of ARPA.This early sentence introduced one of the book’s main themes:The relationship between the military and computer establishments began with the modern computer industry itself.This tech-and-military romance has not gone away in 2025.Chapter 2: A Block Here, Some Stones ThereThis is still a problem today, only partly solved by containers:In [the 1960s], software programs were one-of-a-kind, like original works of art, and not easily
4ヶ月前
