Tux Machines

Programming Leftovers

Posted by Roy Schestowitz on Dec 14, 2025

IBM: Fedora, Flatpak, and Oracle Linux
today's howtos

Matt Godbolt ☛ Pop goes the...population count?

↺ Pop goes the...population count?
Who among us hasn’t looked at a number and wondered, “How many one bits are in there?” No? Just me then?
Actually, this “population count” operation can be pretty useful in some cases like data compression algorithms, cryptography, chess, error correction, and sparse matrix representations. How might one write some simple C to return the number of one bits in an unsigned 64 bit value?

Matt Godbolt ☛ Unrolling loops — Matt Godbolt’s blog

↺ Unrolling loops — Matt Godbolt’s blog
A common theme for helping the compiler optimise is to give it as much information as possible. Using the right signedness of types, targeting the right CPU model, keeping loop iterations independent, and for today’s topic: telling it how many loop iterations there are going to be ahead of time.
Taking the range-based sum example from our earlier post on loops, but using a std::span1, we can explore this ability. Let’s take a look at what happens if we use a dynamically-sized span - we’d expect it to look very similar to the std::vector version: [...]

Matt Godbolt ☛ Induction variables and loops — Matt Godbolt’s blog

↺ Induction variables and loops — Matt Godbolt’s blog
Loop optimisations often surprise us. What looks expensive might be fast, and what looks clever might be slow.
Yesterday we saw how the compiler canonicalises loops so it (usually) doesn’t matter how you write them, they’ll come out the same. What happens if we do something a little more expensive inside the loop?

Matt Godbolt ☛ Multiplying our way out of division — Matt Godbolt’s blog

↺ Multiplying our way out of division — Matt Godbolt’s blog
I occasionally give presentations to undergraduates, and one of my favourites is taking the students on a journey of optimising a “binary to decimal” routine. There are a number of tricks, which I won’t go in to here, but the opening question I have is “how do you even turn a number into its ASCII representation?”
If you’ve never stopped to think about it, take a moment now to do so, it can be a fun problem.

Matt Godbolt ☛ ARM's barrel shifter tricks — Matt Godbolt’s blog

↺ ARM's barrel shifter tricks — Matt Godbolt’s blog
Yesterday we talked about how the compiler handles multiplication with a constant on x86. x86 has some architectural quirks (like lea) that give the compiler quite some latitude for clever optimisations. But do other processors have similar fun quirks?
Today we’re going to look at what code gets generated for the ARM processor. Let’s see how our examples come out: [...]

Yordi Verkroost ☛ Advent of Code 2025: Waking Up With Puzzles

↺ Advent of Code 2025: Waking Up With Puzzles
Advent of Code has become a yearly thing for me. It’s a way to keep my algorithmic and data structure skills up, and something I look forward to every December. Over the years, I’ve used it to learn a new programming language: I’ve done editions in Elixir, Java, TypeScript, and others. But the last few years, including this one, I’ve just used Python.

Tymscar ☛ I Tried Gleam for Advent of Code, and I Get the Hype

↺ I Tried Gleam for Advent of Code, and I Get the Hype
It is one of the few tech traditions I never get bored of, even after doing it for a long time. I like the time pressure. I like the community vibe. I like that every December I can pick one language and go all in.
This year, I picked Gleam.

Juha-Matti Santala ☛ I’m a tool builder at heart

↺ I’m a tool builder at heart
Somebody needs to build the tools we use. The only way we can ignore them as implementation details is to let others — often corporates whose incentives don’t align with ours — to decide what tools we have and how we can use them.
That’s a core value in IndieWeb community for me. It’s difficult to take ownership of data and content and the control of them if we don’t build tools that allow that.

Henrique Dias ☛ An Update on Processing Bosch's eBike Flow FIT Files

↺ An Update on Processing Bosch's eBike Flow FIT Files
At the time, I wrote a script to fix the FIT files and consolidate the records, and I’ve been using it since. At first, I was importing the workouts with HealthFit, but then I noticed there was something weird happening with the display of total calories, so I ended up using RunGap. It seemed like that when importing it with HealthFit, the number of calories was being greatly reduced if there was pauses, but not with RunGap.
Both of these are paid apps. I like supporting small individual developers, and paying for a yearly subscription if their app brings good value. And I pay for both of these. However, RunGap’s yearly package has just expired, and I thought: it’s a bit too expensive just for importing files. So I decided to take another stab at this, and try to solve the problem.

Abhinav Sarkar ☛ Solving Advent of Code 2025 in Janet: Days 5–8

↺ Solving Advent of Code 2025 in Janet: Days 5–8
I’m solving the Advent of Code 2025 in Janet. After doing the last five years in Haskell, I wanted to learn a new language this year. I’ve been eyeing the “New Lisps”1 for a while now, and I decided to learn Janet.
Janet is a Clojure like Lisp that can be interpreted, embedded and compiled, and comes with a large standard library with concurrency, HTTP and PEG parser support. I want to replace Python with Janet as my scripting language.
Here are my solutions for December 5–8.

The New Stack ☛ Three Core Principles for Sustainable Platform Design

↺ Three Core Principles for Sustainable Platform Design
Applying product thinking makes it clear that a platform should not attempt to solve every use case, nor should it force a single narrow path. Instead, platform products are a curated set of solutions that encode what is unique to the business but common enough across application teams to be worth sharing.
A practical way to assess platform value is to test how well it can support three essential outcomes: [...]

Victor Zverovich ☛ Faster double-to-string conversion

↺ Faster double-to-string conversion
There comes a time in every software engineer’s life when they come up with a new binary-to-decimal floating-point conversion method. I guess my time has come. I just wrote one, mostly over a weekend: [...]

[Repeat] Liam Proven ☛ What's the point of lightweight code with modern computers?

↺ What's the point of lightweight code with modern computers?
I think there are many.
Some examples: [...]

Rlang ☛ Un-debunking the GAMLSS myth

↺ Un-debunking the GAMLSS myth
Generalized additive models for location, scale, and shape (GAMLSS) are popular for estimating reference equations, e.g., for lung function measurements.

Server

Web Performance Calendar ☛ Intro to Performance of React Server Components - Web Performance Calendar

↺ Intro to Performance of React Server Components - Web Performance Calendar
Have you heard of React Server Components? Even if you don’t work with React daily, you probably have. It’s been the hottest topic in the last few years in the React Community.

Perl / Raku

Rakulang ☛ Day 12 – Mathematician’s Yahtzee – Raku Advent Calendar

↺ Day 12 – Mathematician’s Yahtzee – Raku Advent Calendar
Santa was playing and losing yet another game of Yahtzee with Mrs. Claus and the elves when a thought occurred to him: why don’t you get points for rolling the first 5 digits of the Fibonacci sequence (1, 1, 2, 3, 5)? For that matter, why isn’t there a mathematician’s version of Yahtzee where you get points for rolling all even numbers, all odd, etc. After a bit of brainstorming, Santa came up with the following rules: [...]

Perl ☛ Perl Advent Calendar 2025 - Thirty Slices, Twenty-Four Days: How Christmas Was Saved By Abandoning Estimation

↺ Perl Advent Calendar 2025 - Thirty Slices, Twenty-Four Days: How Christmas Was Saved By Abandoning Estimation
Day 1, Vasco and the team listed everything the system needed to do. Then they broke it down: [...]

R / R-Script

Rlang ☛ Smoothed ROC Curves, Calculus and Curvature

↺ Smoothed ROC Curves, Calculus and Curvature
A common use of ROC (Receiver Operating Characteristic) curves in data science is to evaluate performance of binary classifiers. In this use case, the data set is usually a sample from a population and so the ROC curve itself is a random object. Although it is not common to have multiple sample ROC curves constructed from applying the same classifier to multiple sample data sets from the same population, it would be interesting to be able to construct a mean ROC curve from multiple sample ROC curves. One way to go about this would be to use the theory of functional data analysis (FDA) to construct curves from the sample points in such a way that the curves themselves become the random objects of study. The first step in the FDA process typically is to use splines to construct a set of basis functions to smooth the sample points into functional objects. In this post, I am going to explore this first step of smoothing ROC curves, and point out that once you have a smoothed ROC curve, it is possible to use calculus and concepts from basic differential geometry to analyze the curves. The flow of the post is as follows: [...]

Java/Golang

Redowan Delowar ☛ Tap compare testing for service migration

↺ Tap compare testing for service migration
Typically, you don’t have to build all the plumbing by hand. Proxies like Envoy, NGINX, and HAProxy, or a service mesh like Istio, can help you mirror traffic, capture tap events, and feed them into a shadow service. I left out tool-specific workflows so that the core concept doesn’t get obscured.
Tap compare doesn’t remove all the risk from a migration, but it moves a lot of it into a place you can see: mismatched payloads, noisy writes, and gaps in business logic. Once those are understood, switching over to the new service is less of a big bang and more of a boring configuration change, followed by trimming a pile of *Tap code you no longer need.

[Old] Julien Cretel ☛ Pure vs. impure iterators in Go

↺ Pure vs. impure iterators in Go
Until recently, the data structures over which you could iterate via a for-range loop were limited to arrays (either directly or through a pointer), slices, strings, maps, channels, and integers. However, in the wake of Go 1.18’s support for parametric polymorphism (a.k.a. “generics”), Go 1.23 standardised the way of defining custom iterators, saw the addition of the iter package in the standard library, and welcomed a couple of iterator factories (i.e. functions or methods that return an iterator) in the slices and maps packages. And Go 1.24 marked the inception in the standard library of even more iterator factories, such as strings.SplitSeq: [...]
gemini.tuxmachines.org