Skip to main content

Benjamin Oakes

Photo of Ben Oakes

Hi, I'm Ben Oakes and this is my geek blog. Currently, I'm a Ruby/JavaScript Developer at Liaison. Previously, I was a Developer at Continuity and Hedgeye, a Research Assistant in the Early Social Cognition Lab at Yale University and a student at the University of Iowa. I also organize, ICRuby, OpenHack Iowa City, and previously organized NewHaven.rb. I have an amazing wife named Danielle Oakes.

Filtering for the month September, 2013. Clear

No iPhone, that’s not what I meant

by Ben


Iowa City, as seen on The West Wing

by Ben

We finally watched the episode of The West Wing that features Iowa City’s famous Hamburg Inn No. 2 (after randomly finding it at the Iowa City Public Library).  It had been on my list for quite a while!

Some context:

The Hamburg Inn No. 2 is a small family diner located near downtown in Iowa City, Iowa, in the United States. The Hamburg Inn is a regular stop for presidential candidates during the Iowa Caucuses. Ronald Reagan, Bill Clinton, and Barack Obama have visited, and the restaurant was featured on the TV show, The West Wing. (Wikipedia)

We were happy to see Iowa City represented, but were a little disappointed that the episodes at Hamburg were filmed in Pasadena, CA.  However, it took two locals watching the Hamburg scene more than once and listening to the commentary to be able to tell.  That someone on that show took the time and effort to recreate Linn St as well as they did is commendable.  They certainly could have just put some signs on any diner, and most of the country would have been none the wiser.

Ruby Simple HTTP Server, minimalist Rake

by Ben

I use a really simple HTTP server all the time. It happens to be written in Python:

python -m SimpleHTTPServer 5000

That serves all the files in the current directory over HTTP on port 5000. Honestly, it works just fine, but I’ve always wondered if Ruby had an equivalent.

Here it is:

ruby -run -e httpd . -p 5000

(from Aaron Patterson’s tweet found via Zach Morek)

It’s pretty much the same, except it’s written in Ruby. More often than not, that’s not a big difference — except I can understand the code behind it.

# = un.rb
# Copyright (c) 2003 WATANABE Hirofumi <>
# This program is free software.
# You can distribute/modify this program under the same terms of Ruby.

# [...]

# Run WEBrick HTTP server.
# ruby -run -e httpd -- [OPTION] DocumentRoot
# --bind-address=ADDR address to bind
# --port=NUM listening port number
# --max-clients=MAX max number of simultaneous clients
# --temp-dir=DIR temporary directory
# --do-not-reverse-lookup disable reverse lookup
# --request-timeout=SECOND request timeout in seconds
# --http-version=VERSION HTTP version
# -v verbose

def httpd
  setup("", "BindAddress=ADDR", "Port=PORT", "MaxClients=NUM", "TempDir=DIR",
        "DoNotReverseLookup", "RequestTimeout=SECOND", "HTTPVersion=VERSION") do
    |argv, options|
    require 'webrick'
    opt = options[:RequestTimeout] and options[:RequestTimeout] = opt.to_i
    [:Port, :MaxClients].each do |name|
      opt = options[name] and (options[name] = Integer(opt)) rescue nil
    unless argv.size == 1
      raise ArgumentError, "DocumentRoot is mandatory"
    options[:DocumentRoot] = argv.shift
    s =
    shut = proc {s.shutdown}
    siglist = %w"TERM QUIT"
    siglist.concat(%w"HUP INT") if STDIN.tty?
    siglist &= Signal.list.keys
    siglist.each do |sig|
      Signal.trap(sig, shut)

So how does it work? It’s actually a little surprising. Here’s the command again for reference:

ruby -run -e httpd . -p 5000

In order:

While that code is probably too clever, it’s nice to have a simple HTTP server wherever I have Ruby.

Even more, the concept is reusable:

# File: ake.rb
# Minimalist rake.  :)
def greet
  puts "Hello, #{ ARGV[0] }!"

Here’s the output

$ ruby -I . -rake -e greet Ben
Hello, Ben!
$ ruby -r ./ake -e greet Ben
Hello, Ben!

That could be a nice minimalist way to write some helper scripts without Rake or Thor.

Disabling RdRand in Linux

by Ben

Linus Responds To RdRand Petition With Scorn – Slashdot.
Torvalds’ response to whether RdRand could be compromised in the Linux kernel | Hacker News.
Linus Torvalds responds –

This got a surprising amount of attention, mostly because of one of Linus’ classic responses. My feeling is that it’s good to question these types of things. However, making a petition against using a hardware random number generator, and including some vague concerns about the NSA probably isn’t quite the right way to go about it.

Anyway, I learned today (from a Slashdot comment) that you can simply pass nordrand to the kernel to disable RdRand if you really don’t like it. Whether or not “the NSA” is on your list of reasons is up to you.

PostgresSQL 9.3 (now with more JSON)

by Ben

PostgresSQL: The Other big open-source database has a new release | ZDNet.

It includes some new built-in functionality for handling data serialized as JSON. Sounds really interesting!

Filtering on MIME type in Maid

by Ben

From recent issue on GitHub:

Yep, that will be a part of Maid v0.4.0.

I’ve released some alpha builds (which are probably closer to beta quality), if you’d like to start playing with that functionality. I’d like to do some more testing to make sure everything works as expected, has a nice syntax, etc. Unfortunately, we’re in the middle of moving to a new place, so my time is limited right now.

Beta testing is always very appreciated, so if you have comments on how this feature works, please share! The method you want is probably where_content_type(). There are some examples in the documentation.

A big-enough house

by Ben

The 400-square-foot dream home.

Given a choice between consumerism and minimalism, I often tend towards the latter. Although I don’t think I could ever live in a small home unless I were a bachelor, there’s something about an Anti-McMansion homes that’s in line with my way of thinking. You’d only ever keep essentials in a 400 square-foot home. You just wouldn’t have room for anything else.

A number of Iowa Citians seem to feel the same way, including some people I know, as well as the subject of the linked article. It’s nice when Iowa City is in the news for all the little quirks that make it great.

Am I planning to own a small home? No, but I think we’ll have a “big-enough house”. There are many forms of minimalism. It doesn’t mean that you give everything up, just that you get rid of extraneous things. Is that something I do well? Sometimes. Sometimes not.

If nothing else, reading blogs like Leo Babauta’s mnmlist was really helpful when we moved across the country. We got rid of everything that we could, and have only replaced what we really missed. Could we still get rid of more? Probably. Gaining clutter can still be a problem, but if you’re honest with yourself, you can declutter too.

I don’t always use eval in JavaScript, but when I do, I stop and do things the right way anyway

by Ben

I don't always use eval in JavaScript, but when I do, I stop and do things the right way anyway


BitTorrent Sync between Ubuntu, Android, and iOS

by Ben

BitTorrent Labs – Sync.

I was happy to find our today that BitTorrent Sync is available for iOS, in addition to Ubuntu, Android, and a wide variety of other Linux platforms.  My NAS has a MIPS processor though, so it can’t run Sync… yet.

I’ve been intrigued by the concept behind BitTorrent Sync, as I don’t like the idea of all my music, documents, etc having to go through the Internet and a third party just to be synced wirelessly. I’ve tried other options like SparkleShare (which works well for small files, but isn’t good on mobile at all) and ownCloud (more Dropbox-like, but needs polish). I’m hoping Sync will meet their shortcomings.

The iOS port seems much more limited than Android — probably because of platform constraints, which may explain why it took longer. For example, Android seems nicer in that BitTorrent Synced music can be played in any music app. Also, it doesn’t seem to support “Open In” for iOS, at least for PDFs.  I really wish iOS app integration was more like Android in this respect.  (Apple, there’s more on my iPhone than a shared photo library!)

That’s just my quick take, as I’ve used it very little so far.


Privacy in 2013: Retail stores track you using your smartphone

by Ben

How Retail Stores Track You Using Your Smartphone (and How to Stop It).

I had figured brick-and-mortar stores would want to be able to do the same amount of massive digital tracking as Amazon, Google, Facebook, etc… but I hadn’t realized this was a way that it could be done. Basically, stores can keep track of a unique identifier (MAC address) when your WiFi passively searches for a signal. This is without your involvement, as long as your device’s WiFi is on. It can be correlated with the security camera footage as well, automatically tracking your reactions to products as you walk around a store. Whoa.

That seems like it should need an opt in rather than an opt out (turning off WiFi, in this case). It’s not clear which stores do this or which plan to, but I would guess most major ones are at least considering it. The mall scene of Minority Report keeps getting closer and closer…