Skip to content

Instantly share code, notes, and snippets.

View atombender's full-sized avatar

Alexander Staubo atombender

View GitHub Profile
@atombender
atombender / gist:8359763
Last active January 2, 2016 20:49
Development environment setup

Preliminaries

Install Ruby

Either using brew, or via rbenv.

To avoid issues with gem installation, configure gem with --no-ri. Here is a sample ~/.gemrc that has some sensible settings:

install: --no-rdoc --no-ri --env-shebang

update: --no-rdoc --no-ri --env-shebang

@atombender
atombender / challenges.md
Last active January 3, 2016 03:59
Some technical challenges.

Challenges

Geocoding

Consider a distributed (ie., deployed on multiple machines) application designed to geocode data.

The app listens to a queue (eg., Amazon SQS). Other apps put addresses to be geocoded into this queue. The app geocodes using the Google Maps API.

Because of Google's licensing rules, the application can only process 2500 items per day before being rate limited. Indeed, Google may at any time fail a request by returning an "over the limit" error.

require_relative './lib/pebbles/river'
logfile = File.open("./daemontest.log", 'a')
logfile.sync = true
logger = Logger.new(logfile)
$logger = logger
Listener1 = Class.new do
def call(message)
[0] PUBLISHED
[1] PUBLISHED
[2] PUBLISHED
[2] CAUSING DISCONNECT
[2] FAILED Errno::EBADF: Bad file descriptor...
E, [2014-08-27T16:10:57.933061 #92570] ERROR -- #<Bunny::Session:70208098727580 [email protected]:5672, vhost=/>: Exception in the reader loop: Errno::EBADF: Bad file descriptor
E, [2014-08-27T16:10:57.933172 #92570] ERROR -- #<Bunny::Session:70208098727580 [email protected]:5672, vhost=/>: Backtrace:
E, [2014-08-27T16:10:57.933213 #92570] ERROR -- #<Bunny::Session:70208098727580 [email protected]:5672, vhost=/>: /usr/local/opt/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bunny-1.3.1/lib/bunny/cruby/socket.rb:48:in `select'
E, [2014-08-27T16:10:57.933254 #92570] ERROR -- #<Bunny::Session:70208098727580 [email protected]:5672, vhost=/>: /usr/local/opt/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bunny-1.3.1/lib/bunny/cruby/socket.rb:48:in `rescue in read_fully'
E, [2014-08-27T16:10:57.933291 #92570] ERROR -- #<Bunny::Session:70208098727580 [email protected]:5672, vhost=/>: /usr/local/opt/rbenv