Here is an implementation of a LoRa demodulator in less than 900 lines of C. It reads I/Q samples from stdin has no dependencies outside of the standard library.
tavl is an implementation of AVL trees that keeps all nodes in a flat statically-allocated array. It's intended for use on embedded systems where one may want to index a set of items with a fixed upper bound, and where the set of items is too large for a linear search to be fast enough.
The LPC54113 doesn't currently have direct support for flash programming in OpenOCD, but it can be made to work purely via Tcl.
After trying a lot of different calendar and organizer programs I finally gave up and wrote my own. This script enables me to summarize and organize information by topic using a plain text format spread across multiple files. On request, all files are scanned for tags indicating TODO items or deadlines, and the result is printed in a short half-page hierarchial summary.
The Adler-32 checksum is used in the DEFLATE format as an integrity check on decompressed data. It's fast to calculate, but it can be even faster if you know that parts of your data consist of repeated subsequences.
I recently needed to generate documentation in TeX for a board which was configured via jumpers placed on header pins. I wrote the Perl script shown here to quickly generate high-quality PDF images of different jumper settings for inclusion in the documentation. The script is approximately 200 lines, has no dependencies aside from the Perl interpreter itself, and can easily be modified to draw other kinds of diagrams.
INI-like formats are understandably popular as human-readable configuration files for many server applications. Presented here is a very small (under 300 lines) parser written in C#, supporting a flexible variant of the format.
Some applications will require bulk reads and writes of large collections of rows from a table on a PostgreSQL server. If the collection of rows is patternless (not falling into a contiguous subset), it would seem that a separate round-trip query is required for each row. Fortunately, this is not the case, and large operations of this kind can be done with a small fixed number of round-trips.
The following instructions are for building release Y of libmsp430.so from source on a 64-bit Debian-like Linux system for use with MSPDebug. These instructions may be applicable to other systems.
In-field and remote updates of firmware are a useful thing to have on most consumer products, but many update schemes aren't implemented well. A lot of devices suffer from vulnerability windows during firmware updates, where a power failure will lead to the device being bricked. Avoiding these vulnerability windows always means having some kind of bootloader on the device which doesn't get reprogrammed, in which case the methods of update might be frozen for the lifetime of the device.
pan2 is a poker odds calculator. For any game scenario, it produces a table showing win/loss probabilities for each player, plus the distribution of hand ranks that each player can expect. It can calculate odds for a variety of game rules including 5-card draw, Texas hold 'em, Omaha hold 'em, and lowball variants. Calculation for most games is extremely fast (tens of milliseconds on a modern PC). For more expensive evaluations, multithreaded processing is available.
If you need to communicate with other people via Slack, but would prefer to avoid the web interface and Electron application, they offer an IRC gateway. Unfortunately, the gateway has some shortcomings that make it a fairly unsatisfactory solution. I ended up implementing my own gateway in the form of a locally-running Perl script that communicates with Slack's RTM interface.
The code contained here consists of a module for manipulating PDF objects (pdf.fs), and a very simple parser for Adobe Font Metrics files and glyph-lists (afm.fs).
This program is a utility which takes host and parasite trees (in NEXUS format), and a link matrix (in CSV format), and generates an input file for the Jane cophylogeny reconstruction software.
Given the set of all bitstrings of length n with exactly k bits set, you can arrange them in lexicographical order. You can then convert between bitstrings and indices into this list. Can you do this efficiently when n is large and the list is too large to fit into memory?
Rund is a lightweight stand-alone process supervisor for Linux. It takes an ordinary process and makes it into a supervised daemon, with automatic restart, rotating logs, and safe synchronized shutdown and startup. It doesn't require any installation, configuration files or special directory structures.
This document explains how I, with some assistance and quite a bit of background research by Simon Guest at TracMap, got the PowerVR SGX drivers (3_01_00_03) working with Android 4.3 on the Gumstix Overo. What's described here isn't a finished product, but it's enough to get SurfaceFlinger up and running with hardware acceleration.
uFAT is small but feature-complete VFAT/FAT32 implementation. It supports all basic filesystem operations and has minimal memory requirements.
MSPDebug is a free debugger for use with MSP430 MCUs. It supports FET430UIF, eZ430, RF2500 and Olimex MSP-JTAG-TINY programmers. It can be used as a proxy for gdb or as an independent debugger with support for programming, disassembly and reverse engineering.
This document explains how to build, on a POSIX system, a cross-compiling GCC targeting both 32 and 64 bit Windows systems, with C++11 threads support. It uses MinGW-w64.
Although the tslib library is often used on embedded Linux systems for touch-screen filtering, it can be done in a flexible and effective way in just a hundred or so lines of C++. The method described here has been tested on both a resistive touch-screen and a capacitative touch-pad.
This pair of files implement a very lightweight wrapper for the public-domain SQLite3 database library. There are no external dependencies, apart from the SQLite3 library itself.
Some time ago, I implemented a very simple Perl script for the removal of HTML boilerplate (advertising, comments and other clutter surrounding the content on commercial websites). The script is less than 300 lines long, and uses very simple a series of tree-processing algorithms which can be customized and tuned.
This article describes a method of implementing fixed-size bit-queues, or shift registers, for very fast real-time operation. The method described is far faster and more flexible than shifting through multiple machine words.
This package contains portable public-domain implementations of Daniel J. Bernstein's Curve25519 Diffie-Hellman function, and of the Ed25519 signature system. The memory consumption is low enough that they could be reasonably considered for most microcontroller applications. In particular, Curve25519 scalar multiplication uses less than half a kB of peak stack usage.
This package implements a simple and effective shadow-paging scheme for use with NOR flash or EEPROM. It allows small sets of data (such as configuration) to be stored atomically and reliably in the face of power and programming failures.
These are NaCl-compatible primitives optimized for use on small (8 and 16-bit) MCUs. They use a very small amount of stack space, at a modest performance penalty. The implementation is in the public domain.
Dhara is a small flash translation layer designed to be used in resource-constrained systems for managing NAND flash. It provides a mutable block interface with standard read and write operations.
Anuweb is a Totem plugin which provides a simple web interface. Via the interface, you can control playback (play, pause, toggle full-screen, seek, etc.) and browse for files.
A static stack analysis tool for AVR-GCC (but portable to other architectures.
This article serves as an introduction to asynchronous programming, explaining the differences between asynchronous and event-based programming, and describing some basic techniques.
G.H. Hardy's autobiography, has been made available in PDF format by the University of Alberta's Mathematical Science Society. Attempts to convert the document to HTML using tools like pdftotext or pdftohtml yield poor results -- out-of-order text, missing paragraph breaks, unwanted page numbers and inconveniently placed footnotes. By extracting and examining all available typesetting information in a PDF, we can do a better job than this.
Saraswati is a text-mode EPUB reader for Linux. It is fast, small and easy to use.
QR codes are a type of high-density matrix barcodes, and quirc is a library for extracting and decoding them from images.
A summary map is a drop-in replacement for std::map with the additional property that it supports efficient computation of aggregate functions over contiguous ranges.
Katcat is a tool for extracting media files from a Sanyo 6650 CDMA phone (also known as Katana II) via the USB data cable.
Calcudoku is a sudoku-like game invented by Tetsuya Miyamoto (marketed under the trademarked name "KenKen"). This program can be used to examine, print, solve and generate Calcudoku problems of any size up to 16x16.
Many peripherals still use raw UART-based protocols like RS-232 and RS-485, particularly in industrial electronics. Any protocol for communication over one of these serial lines needs to be able to cope with transmission errors and garbage.
This script is a simple tool for managing podcast subscriptions. It doesn't use any global configuration or database. Instead, each subscribed podcast is kept in its own directory, which contains the downloaded media files. This is referred to as a podcast repository.
Often, libraries need to be modified before they can be used in an embedded system. These patches add or fix functionality for specific uses of various popular open source software packages.
There are a lot of FFT-based audio visualizations available, but they usually make the mistake of displaying a raw FFT-based bar graph. This leads to a display which flickers wildly and doesn't appear to move in time with the audio. This problem can be fixed though, with a few simple modifications.
I2C is a popular two-wire serial bus protocol for communicating between devices. Most MCUs support it, so it's a good choice of interface for many chips. This article shows how to implement an I2C slave interface without the use of a bus sampling clock.
This article explains a simple method to quickly estimate the difficulty of a Sudoku puzzle which correlates reasonably well with human estimates of difficulty. It also gives an algorithm which can be used to generate difficult puzzles reliably and efficiently. Source code for an implementation of this algorithm is also provided.
PDM is a method of continuously varying the average value of a digital signal, but without having a fixed modulation period, as in PWM. It allows generation of a time-varying signal in software with less CPU load than an equivalent PWM scheme.
This article describes an enhancement to the B+Tree data structure which enables certain types of summaries to be computed on arbitrary contiguous subsets of a B+ tree in O(log n) time. The time complexities of the usual B+Tree operations for insertion and deletion are not affected, and still run in O(log n) time.