Skip to content

Instantly share code, notes, and snippets.

View atombender's full-sized avatar

Alexander Staubo atombender

View GitHub Profile
[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 guest@127.0.0.1:5672, vhost=/>: Exception in the reader loop: Errno::EBADF: Bad file descriptor
E, [2014-08-27T16:10:57.933172 #92570] ERROR -- #<Bunny::Session:70208098727580 guest@127.0.0.1:5672, vhost=/>: Backtrace:
E, [2014-08-27T16:10:57.933213 #92570] ERROR -- #<Bunny::Session:70208098727580 guest@127.0.0.1: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 guest@127.0.0.1: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 guest@127.0.0.1:5672, vhost=/>: /usr/local/opt/rbenv
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)
@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.

@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

[{"cull": true, "weight": 0, "dimension": "kind", "value": "ad"}, {"nullExactMatch": true, "dimension": "photos_count", "exactMatch": true, "id": "Yes"}, {"cull": true, "dimension": "category", "weight": 0, "id": "Real Estate"}, {"operator": "or", "criteria": [{"weight": 0.01, "exactMatch": true, "longitude": -73.759, "latitude": 42.747, "nullExactMatch": true, "dimension": "location"}, {"operator": "and", "criteria": [{"dimension": "city", "value": "Latham"}, {"dimension": "state", "value": "NY"}]}]}]
require 'uglifier'
require 'yaml'
desc 'Create bundle file'
task :bundle do
main_file = File.expand_path('../index.js', __FILE__)
YAML.load(File.open('bundles.yml')).each do |name, opts|
flags = []
if (excludes = [opts['excludes']].flatten)
excludes.each do |exclude|
# Unicode
set convert-meta off
set input-meta on
set output-meta on
# Miscellaneous options
set bell-style audible
set horizontal-scroll-mode off
set mark-directories on
set match-hidden-files on
- (void) updateConstraints {
NSMutableDictionary* views = [NSMutableDictionary new];
[views setObject: textView forKey: @"textView"];
[views setObject: resultTableView forKey: @"resultTableView"];
[self removeConstraints: [self constraints]];
[self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:
@"H:|-15-[textView(>=100)]-15-|"
options: 0
metrics: nil
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai 2</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
/Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/analyze/method_validation.rb:73:in `on_method': undefined method `name' for nil:NilClass (NoMethodError)
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:190:in `execute_callback'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:153:in `block in iterate'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:146:in `each'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:146:in `iterate'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:156:in `block (2 levels) in iterate'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:155:in `each'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:155:in `block in iterate'
from /Users/alex/.rvm/gems/ruby-