blucz.com

My Code

Unless otherwise noted, all source code on this page is released under the BSD License.

record the piano (2013)

Automatic 24/7 recording and soundcloud upload for my Yamaha N3 Piano.

A tiny embedded linux device (Odroid-U2) is plugged into a Behringer USB mixer, which is plugged into the piano using analog audio cables.

When the device boots up, it hops on my wifi network then launches the recordthepiano app, written in C.

An android app allows for remote control and feedback for the recording process. I run this on a docked nexus 7 sitting on the piano.

The recordthepiano app listens to the audio output from the piano constantly, monitoring for sound. It automatically starts/stops recording based on whether the piano is making noise.

Recorded audio is encoded in 44100/16/2 FLAC in real-time. As soon as a recording is completed, the recordthepiano invokes recordthepiano_upload, a ruby script, that uploads the FLAC to my soundcloud.

Source code

Coco/R for F# (2013)

Coco/R is a powerful and easy to use LL(k) parser generator with strong support for C#, Java, and C++. Unfortunately, the official F# release is incomplete and riddled with bugs. Worse, it generates code for a 2007-era pre-pre-pre-release of F# that is not compatible with current compilers.

I used the official release as a starting point and gave it a serious overhaul. It's not as perfect as if it had been built from scratch with F# 2.0 in mind, but does work.

Source code (GPL)

Vector (2012)

Vector emulates a vector display, like those found in Asteroids and Tempest arcade games. It is implemented in OpenGL ES 2.0.

It targets the iPad. For best results, use an iPad 4. Vector runs poorly on the simulator and I haven't tested anything slower than an iPad 4.

This github project contains the reusable vector graphics engine + a small demo program.

Screenshot:

Source code

s3rocket (2012)

s3rocket uploads and downloads large volumes of streaming data to/from amazon s3 very quickly. It is excellent for uploading large directory trees or data that streams out of a process.

You don't need to know the size of the data in advance in order to upload it. The data is split among s3 objects of a fixed size, and is uploaded on the fly in multiple threads.

It is overkill for small files. If you're not transferring at least several gigabytes of data in each go, this is probably not for you. This tool was designed to upload or download ~50gb of data spread across ~100,000 files to or from an EC2 instance in 10 minutes or less.

Source code

bsort (2012)

bsort is a sort utility for fixed-length binary records. It's very fast, even for large input files, but it requires that you have enough address space to mmap the whole file at once.

The sort is implemented using the stdlib qsort function. While quicksort has fairly good locality/sequential access semantics, mergesort is probably the better choice. Unfortunately, most C libraries do not include a mergesort function, so qsort it is.

bsort is consistently at least an order of magnitude faster than GNU sort, but may corrupt the input data if it is interrupted. It is well suited as a sort utility for temporary data in a batch processing pipeline.

Source code

wikipad (2012)

Minimalist personal wiki in F#/Mono/LevelDb. This is used for the mensch wiki.

Source code

Sand (2010)

This is a port of Danny Dulai's Sand to HTML5's <canvas> element. I built this help myself develop an idea of Chrome/V8/Canvas performance. I have not tested in any other browsers.

Click to see

Latitude (2010)

This no longer works because Google shut down latitude on 8/10/2013

I wasn't sure that I could live without a giant mashable Latitude button in by browser, so I made one:

Latitude App Icon

Download latitude.zip, unzip, drag latitude.crx onto chrome.

todo.vim (2008)

Vim syntax coloring for todo list files. I've been happily using this for over five years now. I've also tried vim outliner, tadalist, backpack, and a notebook, but I keep coming back to this because it's so simple and fast to use.

I keep a single .todo file in the root of my dropbox so it syncs between my machines and devices automatically.

It looks like this:
== today
- bug: fix broken rendering code in foo
- bug: fix crash on exit
- misc: pick up blar at the office

== short term
- integrate libflac into foobarbaz
- set up automated backups of photos

== lines
- finish iphone port
- support themes
u what are we going to do about the frog problem
b integrate new design (waiting on bob)

== low priority
- foo
- bar 
- baz

== completed
x do the laundry
x wash the dishes
The first character on the line determines the status of the task:
- uncompleted task
b blocked task (waiting on something)
x completed task
u unresolved task

Be sure to save your files with the .todo extension so vim knows to highlight them.

Download todo.vmb (Use Vimball to install, and make sure you've enabled ftplugin)

Organ (2007)

Uses MIDI input to drive an additive synthesizer, rendering audio using WASAPI. Requires Windows Vista or higher.

(2009 update: I ran into a lot of issues with WASAPI--buggy drivers, inconsistent behavior, buffer drops when there shouldn't be, etc).

(2012 update: I've since used WASAPI successfully in other projects, but only on windows 7/8).

SCGI <-> Io (2006)

As far as I know it still works with recent versions of Io, but it hasn't been booted up in a few years.

Lines (2006)

Color Lines was the most useful thing my (now deceased) palm could do. This is my Cocoa/Quartz port.

Rasteroids (2000)

Asteroids game for DOS. Compiles with DJGPP, I think.

I was 15 at the time, so it's a bit, uh, immature.