Skip to content

Instantly share code, notes, and snippets.

View mroth's full-sized avatar

Matthew Rothenberg mroth

View GitHub Profile
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url = "http://www.ssa.gov/OACT/babynames/decades/names2000s.html"
doc = Nokogiri::HTML(open(url))
doc.css("td td:nth-child(2)").each do |name|
puts name.content
end
@mroth
mroth / gist:1069662
Created July 7, 2011 14:44
blowfish
_
(_)
| .
. |L /| . _
_ . |\ _| \--+._/| . (_)
/ ||\| Y J ) / |/| ./
J |)'( | ` F`.'/ _
-<| F __ .-< (_)
| / .-'. `. /-. L___
@mroth
mroth / gist:1314677
Created October 25, 2011 23:00
npm install script puts stuff in wrong directory
$ brew --version
0.8
$ which node
/usr/local/bin/node
$ node -v
v0.4.12
$ ls -l `which node`
@mroth
mroth / brew --config
Created May 5, 2012 22:04
metadata for homebrew issue #12099
HOMEBREW_VERSION: 0.9
HEAD: 68426f4287ebd9819a8e8c39581e3c8a63964405
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit sandybridge
OS X: 10.7.3
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: build 5666
@mroth
mroth / setup-statsd.sh
Created July 29, 2012 21:55
Turn an Ubuntu 12.04 Amazon EC2 Micro instance into a StatsD/Graphite server
#############################################################################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 12/19/2011
# MORE INFO:
# - http://blog.adku.com/2011/10/scalable-realtime-stats-with-graphite.html
# - https://github.com/gosquared/graphite-cookbook
# - http://coreygoldberg.blogspot.com.es/2012/04/installing-graphite-099-on-ubuntu-1204.html
#############################################################################################
@mroth
mroth / Gemfile
Created June 24, 2013 21:57
Simple SSE example -- works fine locally, connections never close on Heroku. Running at http://obscure-depths-3413.herokuapp.com/
source "https://rubygems.org"
ruby '1.9.3'
gem 'sinatra'
gem 'thin'
gem 'foreman'
@mroth
mroth / keybase.md
Created March 10, 2014 19:19
keybase proof file

Keybase proof

I hereby claim:

  • I am mroth on github.
  • I am mroth (https://keybase.io/mroth) on keybase.
  • I have a public key whose fingerprint is E116 C1C6 652E 47AB 1F3D 09C0 7A8F E576 BBED D364

To claim this, I am signing this object:

@mroth
mroth / compare.rb
Created March 29, 2014 16:24
Comparison of JSON and MsgPack for typical Emojitracker messages
#!/usr/bin/env ruby
require 'json'
require 'oj'
require 'msgpack'
require 'benchmark'
#################################
# set up sample data
#################################
def hash2array(hash)
@mroth
mroth / errormsg.txt
Created May 4, 2014 21:25
Tweets that crash TweetStream
ERROR: MultiJson::DecodeError occured in stream
@mroth
mroth / gist:8d0b685df435d1409038
Created July 24, 2014 17:58
Pondering Elixir pipes
# A very common pattern in Elixir is to define a method that pipes the first
# argument through a series of transformations, for example here is some actual
# Elixir code I just wrote.
@spec encode(String.t) :: String.t
def encode(plaintext) do
plaintext
|> encipher
|> chunk
end