Monthly Archives: June 2011

html2csv

Does what it says on the tin. Do “gem install nokogiri” or “sudo apt-get install libnokogiri-ruby” if necessary.

#!/usr/bin/env ruby

require 'rubygems'
require 'nokogiri'
require 'csv'

def main(f)
  Nokogiri::HTML.parse(open(f)).search('table').each do |t|
    t.search('tr').each do |tr|
      puts CSV.generate_line(tr.xpath('th|td').collect do |td|
        td.text
      end)
    end
    puts
  end
end

ARGV.each { |f| main(f) }

Five-bytecoin note

Stack of five-bytecoin notes

Ever wake up one morning and say “today, I’m going to design my own banknote”? Of course, we all have. But earlier this week, I decided to act on that impulse. And just last night, I printed and laser cut my first batch of bytecoins at Metrix.

For those curious how the bytecoin compares to the (unrelated) bitcoin, I offer this handy chart:

Bytecoin Bitcoin
Not really a coin Not really a coin
Value determined by the free market Value determined by the free market
Making more coins requires proof-of-work
(printing, lasering, etc)
Making more coins requires proof-of-work (math)
Not accepted as payment for taxes or Filets O’ Fish Not accepted as payment for taxes or Filets O’ Fish
Made of cotton paper, just like the US Dollar Made of bits, just like tweets
Transactions are as public or private as cash All transactions are 100% public but pseudonymous
Built-in inflation, as long as I keep printing more Built-in deflation
Looks nice Pretty as a SHA256 hash

The design of the bytecoin was influenced by colorful banknotes I’d seen in the past and some of the Dollar ReDe$ign Project winners. Some of my favorite banknotes are the Dutch Guilder, specifically, the late 60s/early 70s ƒ5, ƒ10, and ƒ25, and the early 80s ƒ50:

By the way, I hear if you’re looking to buy or sell bytecoins, you may find interested parties hanging out at Metrix Create:Space (not an official exchange). I’m sure they’d gladly accept bytecoins as tips.

Bremen, North Dakota



Bremen, North Dakota, originally uploaded by afiler.

Apple II Plus as a USB keyboard

Connecting an Apple II keyboard to a computer with USB is surprisingly easy with a Teensy board. The Apple II uses an ASCII keyboard, which means that rather than returning scan codes, it returns a 7-bit ASCII value. This also means you can’t read the state of modifier keys like shift or control independently. The Apple II keyboard in particular doesn’t even support lower-case letters (though I’ve made a bit of a hack for this). They even re-use a couple alpha keys for other characters, so shift-P makes @ and shift-N makes ^. Other late 70s/early 80s home computers like the TRS-80 had a really simple layout like the Apple II’s (though the TRS-80 had all four arrow keys but no Control key). I may have to try out adapting some other weird old home computers as USB keyboards — the C-64 seems like it would be a good shape/size for that.

Arduino (Teensyduino) code is available at https://github.com/afiler/keyduino.