code for http://undef.ch/#project/receipt-racer (only tested on linux)