Daniel Beer Atom | RSS | About
pan2: poker odds calculator 15 Dec 2017

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.

Slirc: IRC interface to Slack 18 Nov 2017

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.

Low-level PDF manipulation for F# 14 Mar 2017

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).

Jane tree file generator 20 Aug 2016

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.

UART AFSK radio receiver 16 Jul 2016

Implementing a realtime AFSK receiver in software.

Enumerating fixed-weight bitstrings 6 Nov 2015

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?

Lightweight process supervisor for Linux 1 Sep 2015

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.

Android/SGX on the Gumstix Overo 9 Aug 2015

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: small VFAT/FAT32 implementation 19 Jun 2015

uFAT is small but feature-complete VFAT/FAT32 implementation. It supports all basic filesystem operations and has minimal memory requirements.

MSPDebug: debugging tool for MSP430 MCUs 8 Jun 2015

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.

Windows 32/64 cross GCC with C++11 threads support 5 Apr 2015

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.

Touch-screen filtering 23 Jan 2015

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.

Lightweight SQLite3 wrapper for C++ 6 Jan 2015

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.

Simple HTML decluttering 24 Oct 2014

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.

Fast multi-word software shift registers 14 Sep 2014

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.

Curve25519 and Ed25519 for low-memory systems 25 Apr 2014

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.

Simple and effective NOR-flash shadow paging 14 Apr 2014

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.

NaCl cryptography primitives for small MCUs 29 Dec 2013

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: a small and reliable NAND flash translation layer 10 Dec 2013

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: web interface for Totem 1 Aug 2013

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.

Static stack analysis with AVR-GCC 31 May 2013

A static stack analysis tool for AVR-GCC (but portable to other architectures.

Introduction to asynchronous programming 19 Mar 2013

This article serves as an introduction to asynchronous programming, explaining the differences between asynchronous and event-based programming, and describing some basic techniques.

Converting a PDF document to HTML 3 Jan 2013

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: text-mode EPUB reader for Linux. 29 Dec 2012

Saraswati is a text-mode EPUB reader for Linux. It is fast, small and easy to use.

Quirc: a fast and portable QR-code recognition library 29 Dec 2012

QR codes are a type of high-density matrix barcodes, and quirc is a library for extracting and decoding them from images.

An std::map replacement with efficient range queries. 7 Dec 2012

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: Sanyo 6650 (Katana II) user data extraction 28 Jun 2012

Katcat is a tool for extracting media files from a Sanyo 6650 CDMA phone (also known as Katana II) via the USB data cable.

Cdok: calcudoku puzzle generator 24 May 2012

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.

Reliable packetization over a noisy serial line 10 May 2012

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.

Getcast: simple command-line podcast downloader 24 Jan 2012

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.

Miscellaneous patches 24 Jan 2012

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.

A better FFT-based audio visualization 25 Oct 2011

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.

Robust I2C slave without a sampling clock 25 Aug 2011

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.

Generating difficult Sudoku puzzles quickly 13 Jun 2011

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.

Pulse Density Modulation for software DACs 8 Mar 2011

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.

Efficient aggregate computation on B+Trees 10 Feb 2011

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.