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
plot.heat <- function(tmp,state.map,z,title=NULL,breaks=NULL,cex.legend=1,bw=.2,col.vec=NULL,main=NULL,plot.legend=TRUE, ...) {
tmp@data$zCat <- cut(tmp@data[,z],breaks,include.lowest=TRUE)
cutpoints <- levels(tmp@data$zCat)
if (is.null(col.vec)) col.vec <- heat.colors(length(levels(tmp@data$zCat)))
cutpointsColors <- col.vec
levels(tmp@data$zCat) <- cutpointsColors
cols <- as.character(tmp$zCat)
##cols <- "white"
plot(tmp,border=cols, lwd=bw,axes = FALSE, las = 1,col=as.character(tmp@data$zCat),main="A", ...)
if (!is.null(state.map)) {
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@jamiew
jamiew / google_twunter_lol
Created July 28, 2011 20:34
All the dirty words from Google's "what do you love" project: http://www.wdyl.com/
easterEgg.BadWorder.list={
"4r5e":1,
"5h1t":1,
"5hit":1,
a55:1,
anal:1,
anus:1,
ar5e:1,
arrse:1,
arse:1,
@chetstone
chetstone / rvm.rb
Created November 12, 2011 21:31
Using rvm with tcsh
#!/usr/bin/env ruby
# riffing on a tune by Paul at po-ru.com
# 1. Using a bash shell, install rvm according to instructions.
# 2. Install this script in your path, say in ~/bin.
# 3. Make it executable.
# 4. Add the following alias to your .tcshrc:
# alias rvm 'eval `~/bin/rvm.rb \!*`'
# 5. Use and enjoy rvm in your tcsh
# Note that this script relies on a ruby already installed in the path.
# It shouldn't be too hard to enhance it to bootstrap itself using rvm.
@mreid
mreid / INSTALL-VW-OSX.md
Created January 29, 2012 21:59
Install Vowpal Wabbit on Mac OS X Lion

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 ./
@gerigk
gerigk / bootstrap_run_only_once.sh
Created June 3, 2012 13:48
Build binaries to run Pandas with EMR
#!/bin/bash
###################
#configuration here
####################
bucketname="my_bucket_name"
##########################
cd /home/hadoop
#first we set two vars...I had errors without this
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
@gerigk
gerigk / bootstrap.sh
Created June 3, 2012 14:00
Bootstrap file to load binaries for pandas and dependencies
#!/bin/bash
###################
#configuration here
####################
bucketname="your_bucket_name"
##########################
cd /home/hadoop
#first we set two vars...I had errors without this
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LD_RUN_PATH=/usr/local/lib:$LD_RUN_PATH
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
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:

@dsparks
dsparks / str example.R
Created September 10, 2012 02:46
Illustrating the use of str()
# Let's say you want to display a table of model coefficients
# in order of their significance,
# and you want to plot the distribution of model residuals,
# but you don't know how to access these values.
# Use str().
# Generate some random data
NN <- 1000
theData <- data.frame(Alpha = rnorm(NN),
Beta = rnorm(NN))
@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",