
Build GCC with Musl for Raspbian
Musl is a libc replacement designed for embedded systems. It tries to be compatible with POSIX and where possible with glibc, the default c standard library for GCC. Its code is designed to be better for small memory systems. One…

A Compact 16 Node Raspberry PI Cluster
There has been a little bit of a fad recently of building networked clusters of Raspberry PIs and other SBCs. Some large ones to use as beowulf clusters for research. Some for automated testing. And some people using them as…

Choosing the Right CPU Flags for GCC on Raspbian
I’ve been messing with the CPU flags for GCC on Raspberry PI. Raspberry PI1 uses a 32 bit ARM6 cpu, the Broadcom BCM2835. The PI2 uses a 32 bit ARM7 cpu, the Broadcom BCM2836. The PI3 uses a 64 bit…
Printing Stack Traces with File and Line
In an earlier article I described how to generate stack traces when your programs crashes. In that article we had file and line information for Win32 but not Linux. In this article we describe how to add the file and…
Identifying Image Format from the First Few “Magic” Bytes in C++
All popular image file formats ( jpeg, png, gif, etc. ) can be identified from the first few bytes in the file. This is a good thing, because you cannot always trust file name extensions to be correct, and because…

Adding and Removing Routes in the Linux Routing Table
We will go through how to add and remove null routes in c++, though there is a lot more you can do with Linux’ routing tables. For this project I want to use the routing tables like a firewall. I…

The Trouble with gcc’s –short-enums Flag
GCC has a cool and relatively obscure optimization flag called short-enums. It is the kind of tweaky little optimization that I get excited about, but it has a dark side that bit me. What to love about short-enums Normally GCC…

Exponential Moving Averages for Irregular Time Series
In time series analysis there is often a need for smoothing functions that react quickly to changes in the signal. In the typical application, you may be processing an input signal in real time, and want to compute such things…

Packing Data Files into Compiled Executables
Have you ever wanted to distribute a compiled binary that included data files packed into the executable file? Embedding a Data File Before Compilation You can do this before compilation by encoding the file into a binary representation, and then…

Generating a Cross-Platform Unique Machine Fingerprint
Sometimes you need a program to know if it is running on the same machine. There are a lot of purposes for this, but a common one is if you are writing a licensing module. You want to generate a…