Skip to content

Instantly share code, notes, and snippets.

View mdagost's full-sized avatar

Michelangelo D'Agostino mdagost

  • Tegus
  • Chi-town
View GitHub Profile
@mdagost
mdagost / latency.txt
Created June 1, 2012 01:07 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@mdagost
mdagost / gist:3020683
Created June 29, 2012 21:14 — forked from gourneau/gist:3019988
Python Objective C keylogger
"""PyObjC keylogger for Python
by ljos https://github.com/ljos
"""
from Cocoa import *
from Foundation import *
from PyObjCTools import AppHelper
class AppDelegate(NSObject):
def applicationDidFinishLaunching_(self, aNotification):
@mdagost
mdagost / pr.md
Created August 14, 2012 23:39 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@mdagost
mdagost / emr.py
Created September 13, 2012 22:48 — forked from josephwilk/emr.py
Wrapper around elastic-mapreduce to make it easier to use
#!/usr/bin/env python
EMR_COMMAND = os.path.expanduser('~/elastic-mapreduce/elastic-mapreduce')
EMR_LOGGING_DIR = "s3://songkick/emr-logs"
def create_pig_job_flow(pigscript, num_instances=1, extraArguments=[]):
jobname = "Pig_Daily_" + datetime.datetime.now().strftime('%Y%m%d-%H%M%S')
print "Creating pig job flow", jobname, pigscript
args = [EMR_COMMAND,
"--create",
@mdagost
mdagost / map.R
Created February 21, 2013 16:50 — forked from braintreeps/map.R
library(data.table);
library(maps);
library(maptools);
library(spatstat);
library(zipcode);
library(GISTools)
#load the zipcode dataset
data(zipcode);
import sys
import subprocess
import tempfile
import urllib
text = sys.stdin.read()
chart_url_template = ('http://chart.apis.google.com/chart?'
'cht=qr&chs=300x300&chl={data}&chld=H|0')
chart_url = chart_url_template.format(data=urllib.quote(text))
import sys
import subprocess
import tempfile
import urllib
text = sys.stdin.read()
chart_url_template = ('http://chart.apis.google.com/chart?'
'cht=qr&chs=300x300&chl={data}&chld=H|0')
chart_url = chart_url_template.format(data=urllib.quote(text))
desc "install R packages"
task :install_R_packages do
R_packages = File.read("#{release_path}/R_packages.txt").lines.map { |line| line.strip }
R_package_cmd = R_packages.map do |package|
'if(!require(\"'+package+'\")){ install.packages(\"'+package+'\",lib=c(\"'+shared_path+'/R\"), repos=\"http://cran.cnr.
berkeley.edu/\"); };'
end.join(' ')
sudo "sh -c 'if [ ! -d #{shared_path}/R ]; then mkdir #{shared_path}/R; fi'"
after("deploy:update_code") do
deploy.install_R_packages
end

The INSTALL instructions that come with Vowpal Wabbit appear not to work on Mac OS X Lion. Here's what I did to get it to compile. You will need the developer tools that come with the XCode installation.

The only dependency VW has is the boost C++ library. So first, download and install Boost

To install Boost, do the following:

$ cp ~/Downloads/boost_1_48_0.tar.bz2 ./