Jevons paradox happens when the cost of a resource goes down, but the total spend on that resource goes up. It sounds like the total spend should go down since the price went down, but the decreased cost allows for more use within the same budget, and opens up for new families of usage: things that were previously net-negative because of the resource cost are all of a sudden net-positive 1 . A…
On May 23, 2011, I bought Building Java Programs 2nd edition from bokkilden.no to learn how to program. A week later, product.support@pearsoned.com emailed me a password I had registered an account with in plain text. The world was different. A little later, on September 25th 2011 at 22:21:55 UTC, I created my GitHub account 1 . I've been on GitHub for basically my entire life as a programmer, and…
After I found that llms are useful , I wanted to get a better feel for what they are useful for. Clearly, they are good at generating boilerplate and writing bash one-liners, but what else? I wanted to see how difficult it was to set up an agent loop that has some objective that it can evaluate autonomously, let it run and see what happens. Also, I wanted some idea what was happening in the…
My static site generator has a quirk: there's no "draft" marker for posts. Everthing that's in the right folder gets published. This means I have a separate draft directory where I place unfinished scraps and ideas. Creating a new draft has meant copying an existing draft, deleting the markdown contents, and replacing the frontmatter fields manually. It's annoying to do, and it's dumb to do…
ark is my latest personal service, after my own rss reader. The stack is the same as the other services, and it all lives in the same repo. ark stores markdown documents, and that's basically it. It also uses qdrant for embeddings for the docs so that I can do similarity search. The embeddings come from OpenAI's text-embedding-3-small model, which have cost me $0.01 so far. This is what it looks…
My personal approach to Advent of Code is to do things from scratch. Using a regex library might be okay to use but a sledgehammer like z3 is not. Any manual steps is certainly forbidden. I'd rather look up hints for a problem online than solving it in the "wrong" way. This years day 10 part 2 was a problem, because I couldn't find a solution that wasn't horribly slow. It seems I was not alone in…
Herbert Edelsbrunner , Elizabeth Stephenson , and myself had our paper published at DGMM 2025 ! Elizabeth is going to Groningen to present it this week, which is very exciting. A slightly old version of the paper is available on arXiv . We've also built an interactive editor for the project, which is hosted here and is open source . The paper is my first publication, which is funny since I left…
Last Friday was my last day at Vind AI . When I joined the company in 2022 it was five months old and we were 7 people, eveyone included. It was my first "normal" full-time job. Today Vind reports having over 1500 registered users and have an impressive logo carousel on their website. It's been a lot of fun to help build a company from the very early days, when it could feel like we were "just…
I think I've had it with the big social internet. At least for a while. No more Mastodon, HN, Lobste.rs, podcasts, Shorts, or other places that inevitabely devolve into screaming matches about topics which I ultimately am not interested in. I have decided that these places are making my life worse, because the downsides of visiting them outweigh the upsides of doing so. I'll continue to happily…
Here's an interesting leetcode-style problem: we are given two points $p_0$ and $p_1$ and a list of $n$ line segments $G=\{g_i\}$ which we call gates . We want to find the shortest path from $p_0$ to $p_1$ that crosses every gate $g_i$ in order. Imagine a boat sailing from port to port through gates to avoid running aground in shallow waters. A Simple Solution A simple solution is to create a…
The ethics 1 of LLMs is a contentious topic. I think this is mainly because of the current reach of the technology (it's everywhere), the hype (people claim it can do anything), and that it's succesful (it's hard to ignore). Unfortunately, a lot of things are mixed into disussions around the ethics of LLMs, and so I've struggeled with figuring out what I think. Here's my personal take on the…
rss is the latest installment in my series of small bespoke services I have written for myself. It looks like this: rss is a list of recent feed items. The front page shows the 20 most recent items from ~70 feeds. Items are marked as read/unread shown by the blue dot to the left. This is clickable, and toggles between the two states. The feed title is also clickable which takes you to the feed…
I took easter off of work and found time to read two books. These aren't exactly reviews, but summaries of some thoughts I had after having read them both. Character Limit Character Limit by Kate Conger and Ryan Mac tells the story about Twitter and Elon Musks purchase and transformation of the service into X. It reads like a documentary, which I really enjoyed. By page 105, Elon has bought 9.2%…
After deploying ppl a few weeks ago I've been continuously adding small features. Some of these turned into larger efforts and all of a sudden I had things to write about. Here's a devlog-style post, without any expectation that there will be more coming. Keyboard Shortcuts ppl is built on htmx , which has features for triggering events from the keyboard. This works great for links or buttons, but…
ppl is a small webapp for storing contacts. It is the first result of me wanting to produce more and consume less . It is a docker image for which you mount a sqlite database, and it runs a single-user password protected web server that you interact with in a browser. I don't know if I'll release it for others to use; I built it for myself, like a home-cooked meal . This is how it looks with dummy…
Lately, I've found myself consuming a lot, and barely producing at all. I've read, but not written. I've listened to music, but barely played myself. I've watched chess analyses instead of playing chess. I guess I have programmed; that's something. This thought struck me when I had to write something at work. Just a few pages of coherent text outlining some ideas I had. Sitting down with an empty…
Most code editors ship with its own color scheme. Basically all editors also allow you to change out the color scheme, and many people do. If we look at the most popular schemes, one commonality between almost all of them is that the color of code comments has low contrast with the background. According to the WebAIM contrast cheker , for "normal text" you need a contrast of 4.5 for AA and 7.0 for…
I took a two week vacation where I found a lot of time to read, and during those two weeks I read four books: Designing Data-Intensive Applications by Martin Kleppmann , Rust Atomics and Locks by Mara Bos , A Philosophy of Software Design by John Ousterhout , and The Staff Engineer's Path by Tanya Reilly . I really enjoyed all four books. Here are some quick notes: Designing Data-Intensive…
In January 2016 I moved this website from Jekyll to Hugo . The motivation was to make deployments easier, since Hugo was a single static binary, and Jekyll is not. Over the years, I did a minimal amount of work on the website itself, and as Hugo kept changing, warnings kept piling up every time I, for whatever reason, updated it. In addition, the few times I did want to change something to the…
I used to think that simplicity is good because of the other values it often brings: a simple system is easier to write; a simple system is easier to build; a simple system is more portable; a simple system is easier to debug and reason about; a simple system performs well; a simple system is easier to change. The word "simple" does some heavy lifting here, and I found that I would often use these…
Recently 1 at work I found myself with an interesting problem in need of solving. The problem was one stage of a larger algorithm, and we wanted to be able to run the whole algorithm in an optimization loop, so it was important that it was fast. The problem is this: given a set of points $P \subseteq\mathbb{R}^2$ and a set of sites $S\subseteq\mathbb{R}^2$, assign each point to a site so that: The…
I'm subscribed to a Substack that I enjoy, but the Substack video player doesn't have any options for adjusting the playback speed of the video. Often, I prefer 1.33 speed, or even 1.5 depending on the content. This has been a little annoying, and what I thought was the alternative, downloading the video (somehow) and playing it in some player which does support changing the speed was a little too…
I have been playing around with LLMs for the past couple of days and decided to try out GitHub Copilot . Overall, the experience so far has been similar to that of ChatGPT, in that sometimes it's helpful, and sometimes it's not. It pretty much always require some tweaking, so you have to know what you're after, and you have to be able to check that its suggestions are actually any good because…
Optimizing compilers are really cool! They look at your code and rewrite it so that it's behavior is unchanged and it's execution time is reduced. The fact that the compiler cannot change the semantics of your code sounds obvious, but there is a crucial detail here: it cannot change your code for any input 1 . If you write a function fn foo(i32) and the compiler wants to generate the code fn…
I spent a lot of time working on a project in which physically plausible simulation of soft materials with pressure chambers was a key part, and in doing so, we managed to improve a part of our simulation by a significant amount. I was very happy with how this small part of the whole system turned out, and I've been wanting to share it for a while. A fair warning though, we need to spend a little…
Let's talk about comptime in Zig . comptime is the feature that allow you to run code at compile time, and is maybe Zig's biggest differentiator from other languages in the same space. Combined with having types as values we get both type specializaton, generics, reflection, and even code generation. For readers who are not familiar with Zig, here's a small example. We can make a Range type that…
I've been using Mathematica a little bit in the past few weeks to do some simple plotting and symbolic manipulation of equations. It's okay ; I keep running into weird behavior and getting funny errors that I assume more seasoned Mathematica users would not get. Here's one of them. With Mathematica has weird scoping rules. For instance, there's a thing called With that let's you assign values to…
The algorithm and notation is based on section 9.3 of Williamson and Shmoys "The Design of Approximation Algorithms". Let $G=(V,E)$ be a graph. A spanning tree $T$ of $G$ is a sub graph $T=(V, E')$ such that $T$ is connected and acyclic. Visually, you can think of it as a network that touches all vertices and doesn't contain and loops. Computing a spanning tree, even a minimal one if we have…
Introduction Like most of my colleagues, I use LaTeX to write papers, reports, notes, or what have you. In fact, I think all of the places that I regularly write supports some variable subset of LaTeX. Also like most of my colleagues, I'm not a TeXnician. I'm not proud to be ignorant in this regard, but there's only so many hours in a day, and the gains from properly learning a huge ecosystem like…
No affiliation with checkmateposters.com blabla Some weeks ago I saw checkmateposters.com on HN(?). The concept is very simple: you generate a poster showing chess positions thoughout a game of your choosing. Colors are also, to some degree, customizable. After considering getting one for a friends birthday, I rather got one for myself, both since their birthday was a little further in the future,…
A quick warning: this isn't one of these "here's the problem, here's the solution, bam bam bam" type of write-ups. This was written while I tried to fix my tablet, and with very little editing after the fact. Don't go in expecting a well though out story arc, as this is meant to reflect how I was working and what I was thinking. I think generally there's way too little material online on how…
As people are arguing over what to call the default git branch, I started thinking about other words in programming that I now take for granted but that I also remember being very confusing and/or strange when starting out. Instead of reading more internet arguments, I figured I'd try to write about some of these words instead. Int Short for integer. Makes sense now, but didn't make much sense…
I woke up today to my computer not booting into my arch installation, but into memtest86+ . A few months ago I also had problems with booting when I flashed a new BIOS 1 that turned out to be a beta version (thanks MSI!) and not working. At the time I removed GRUB and decided to use EFISTUB instead, since I don't need anything fancy for my booting; I only have one disk from which I boot. After…
This post is a stream of conciousness from reading comments at this post. More specifically, this comment got me thinking 1 : You know no-one is forcing you to play CS in your browser, right? Why is it so offensive to you that this exists and someone else is finding joy in playing it? Why does HN love to rag on web technologies so much? The assumption here is that in some places, like HN, it's not…
The problem with OOP isn't the "object" part, it's really the "oriented" part. My problem with OOP isn't really that I despise design patterns, nor that I like all of my data to be in global scope, which OOP at least discourages, nor that I'm convinced that all functions should be pure and any state is the root of all evil. My problem is simply that it doesn't really solve the problems I have when…
The developer of the Rust web framework actix is "done with open source" 1 , as you might have already seen on Reddit 2 , HN 3 , Lobsters 4 , or somewhere else. Steve Klabnik 5 has said a few words, and Raph Linus 6 has some suggestions for how to avoid something like this in the future, but I don't feel like either of them (or any other write-up of this I've seen) does a proper job of addressing…
Spooktober is upon us and it's been a while since I've written anything here, so here's a short computing ghost story that I experienced a few years back. I was living in Zürich at the time with a bunch of people from all over the world, including "Bee" from south korea, and as many other ghost stories, we were enjoying ourselves with beer. I cannot remember exactly what we were talking about, but…
I was reading a few pages of Knuths The Art of Computer Programming , Volume 4A about "branchless computation" (p. 180) in which he demonstrates how to get rid of branches by using conditional instructions. As an instructive example he consideres the inner part of merge sort , in which we are to merge two sorted lists of numbers into one bigger list of the numbers. The description as given by…
Most of us have heard the (unfortunately) famous quote from Donald E. Knuths 1974 paper "Structured Programming with go to Statements". Yes, it's probably the one you're thinking about 1 . It's a really good paper with plenty of interesting ideas that holds up very well especially considering the paper is over 40 years old and is in great part about optimization. I highly recommend you to stop…
We continue our Common Lisp adventure! Day 5 Part 1 It feels natural to first figure out how to find an reduce a pair of chars. A solution based on arrays might be easier to implement without having to loop through the input line multiple times, since we risk the situation that removing one pair of chars may make the new neighbors be reducable, like so: abcdDCBA abcCBA abBA aA With the array based…
The only exposure that I have to Common Lisp is that I wrote about 1000 lines of it about 4 years ago. Since I don't have any excuse to write CL day-to-day, the days since I last typed defun seems to have added up. Luckily, the Advent of Code is upon us, which is a great way of learning a new language or brushing dust of old skills of a language you once knew; I'm taking the opportunity to finally…
It was friday afternoon and I was working on a proof-of-concept garbage collector for Rust. The general idea of the collector is to have threads register their roots --- pointers to memory that the collector cares about --- and every once in a while a thread collects these roots, fork off a new process, find memory that is no longer reachable from any root, and return these pointers back to the…
Let's talk about abstraction. As we know from RFC 1925 it is easier to move a problem around than it is to solve it. This directly suggests Abstraction Based Development . It goes like this: Have a problem Solve 5% of the problem Invent an abstraction to solve the remaining 95% Recucrse on the abstraction After only 91 steps (more or less) we have reduced the problem to only 1% of its original…
Content aware image resizing, liquid image resizing, retargeting, or seam carving, refers to a image resizing technique where one can insert or remove seams , or "paths of least importance", in order to shrink or grow the image. I was introduced to the concept by a YouTube video by Shai Avidan and Ariel Shamir. In this blog post, I'll go through a simple proof-of-concept implementation of content…
This is a blog series. Read part 1 here Last time we got a basic understanding of the different steps in decoding a JPEG image, as well as how the file is structured. What we did not get was any code or hints at implementation. Finally we get to see an attempt of writing a JPEG decoder, in Rust. Additionally, I have now open sourced the project on GitHub . If you are interested in seeing the full…
In the past months I have spent the evenings and weekends on a little project: a JPEG decoder and encoder, written in Rust. First, I should drop a little disclaimer: at the time I'm writing this post, I have successfully decoded multiple test images, but these are fairly standard type images, so more exotic and advanced parts of the JPEG and JFIF standard are yet to be implemented properly, or…
We all know that floating point nubmers have a limited precision. With small numbers, say between zero and one, we can describe the fractional part of the number in great detail. However, if the number is large, there may not be room for any fractional part. So how large numbers do we need before a == a + 1 ? We'll find our answer by simply checking: #include <stdio.h> int simple() { float num =…
So, what is recursion 1 anyways? Mathematical Induction Explaining recursion might be easier if we understand mathematical induction . Indunction is a proof--technique, which works somewhat like this 2 : Show that we can get from one state to the next state Show that we have an initial state We can now get to any state, after the initial state. The concept can be visalized as climbing a staircase.…
Sometimes one have a memory block where we want to put the first n bytes at the end of the block, rather than the beginning, without changing the blocks themselves, as in the figure below. a , b , and e are pointers to the beginning of A , the beginning of B , and the end of B . a |=========| |=========| | block A | want | block B | b |---------| =====> | | | | | | | | | | | block B | |---------|…
My last attempt at writing a blog didn't go so well. It turns out that finding the time to write a post that is even slightly interesting can be a challenge. But as we've just entered 2016, I'm trying once again. This first post will be a super fast rundown of how this blog was made. I didn't want to spend too much time on creating this web page, as web really isn't my thing. Therefore, I went…