RSSAmplifier

Blog

Hummus and Magnets

I’m Christian Plesner Hansen. I’m a software engineer working out of Århus, Denmark. This is my technical blog.

h14s.p5r.orgRSS feed ↗10 posts

Latest posts

Varfloats

My last post was about a varint format that can hold values from 7 to 2048 bits, LPV256. Here is the format in a nutshell, 7 bits: 0 xxxxxxx 14 bits: 10 xxxxxx xxxxxxxx 21 bits: 110 xxxxx xxxxxxxx xxxxxxxx 28 bits: 1110 xxxx xxxxxxxx xxxxxxxx xxxxxxxx 35 bits: 11110 xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx 64 bits: 11111000 + 8 b 128 bits: 11111001 + 16 b 256 bits: 11111010 + 32 b 512 bits:…

Bigger Better Varints

I recently found myself needing a varint encoding. There are lots of those around but especially after reading about some of the gymnastics people have been doing to make LEB128 fast I decided to try to come up with something more efficient. I’ll describe that format, LPV256, below. Just to rehash, LEB128 works by chopping a given number into 7-bit groups and then chaining them together. For…

Bitwise division

Integer division is expensive. Much more expensive than multiplication. Much, much more expensive than addition. If you’re trying to make some integer operations really fast it’s bad news if you need to do division.

World history is off by one

New years eve 2019 is only a few weeks away. The end of the decade. The last day of the 2010, then the first of the 2020s.

More Than Voronoi

This post is about a generalization of Voronoi diagram that I played around with. It’s probably not that useful but it’s a little fun math with an absolute ton of colorful diagrams.

Stdout is a dead end

I haven’t written much about it on this blog but the project I’ve been working on full time for the last two years is a new kind of terminal, chorus. Current terminals are a relic of the past and chorus is my take on a modern replacement.

A simple way to pre-scramble a sequence

I have this problem where I need to try something a number of times, maybe 64 times, and each time with a different small seed, say a value between 0 and 1024. I’d like the seeds to be reasonably scrambled and I don’t want to see the same one more than once. I also need the same order every time, that’s what I mean by pre-scrambling – the scrambling isn’t dynamic, it’s hardcoded. How do I do this…

Piping into a desktop indicator

This post is about interacting with the graphical desktop environment from a shell script. Specifically: say you have a long-running bash script and you’d like to keep an eye on it through a unity app indicator. How do you make that work in an appropriately unix-y way? (If you’re not sure what I mean see the animation below).

Making tea

This post is about the mathematics of making a good cup of tea. I drink a lot of tea and for a long time I would ignore the direction to use water below boiling, say 75° or 85°. Because – if you don’t have a boiler with a temperature setting how do you get water at less than 100°? Wait for it to cool? Come on!

Why I find IEEE 754 frustrating

Programming languages new (Java) and old (Fortran), and their compilers, still lack competent support for features of IEEE 754 so painstakingly provided by practically all hardware nowadays. […] Programmers seem unaware that IEEE 754 is a standard for their programming environment, not just for hardware. William Kahan