Skip to content

Instantly share code, notes, and snippets.

View anujluthra's full-sized avatar

Anuj Luthra anujluthra

View GitHub Profile
# error occurs when same lexical method (which calls super)
# is defined on the singleton class of two or more objects of different classes,
# and then that method is called on any of the objects
# other than the last one the method was defined on...
def x(obj)
# uncomment eval and it works
# eval "
class << obj
def to_s
@anujluthra
anujluthra / aboriginal dictionary
Created July 4, 2011 23:30
Pull out aboriginal words and their meaning from http://www.grandpapencil.net/austral/abword/
require 'hpricot'
require 'open-uri'
dictionary = {}
for letter in ('a'..'z').to_a do
begin
puts "building dictionary for all: #{letter}"
doc = Hpricot(open("http://www.grandpapencil.net/austral/abword/ab#{letter}.htm"))
doc.search("li").search("div").each do |elem|
word = elem.search("font").first.search("strong").inner_html
@anujluthra
anujluthra / mogilefs_setup.sh
Created May 14, 2012 04:02
setting up MogileFS on Macs
# initially compiled by joff
sudo perl -MCPAN -e 'install Danga::Socket'
sudo perl -MCPAN -e 'install Gearman::Client'
sudo perl -MCPAN -e 'install Gearman::Server'
sudo perl -MCPAN -e 'install Gearman::Client::Async'
sudo perl -MCPAN -e 'install Net::Netmask'
sudo perl -MCPAN -e 'install IO::WrapTie'
sudo perl -MCPAN -e 'install IO::AIO'
sudo perl -MCPAN -e 'install List::MoreUtils'
@anujluthra
anujluthra / backend.js
Created July 24, 2012 04:46 — forked from apeckham/backend.js
simple statsd backend that prints json to /var/log/statsd.log
exports.init = function(startup_time, config, events) {
events.on('flush', function(timestamp, metrics) {
console.log(JSON.stringify(timestamp));
console.log(JSON.stringify(metrics));
});
return true;
};