This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Takes a list of int args to sort */ | |
#include <stdio.h> | |
void swap(int array[], int n, int m) { | |
int tmp = 0; | |
tmp = array[n]; | |
array[n] = array[m]; | |
array[m] = tmp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inplace quicksort in python | |
from functools import partial | |
import operator | |
import random | |
import time | |
def partition(list_, l, r, p): | |
pVal = list_[p] | |
list_[p], list_[r] = list_[r], list_[p] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
empty = None | |
color, left, root, right, red, black = range(6) | |
rbnode = lambda c, l, t, r: {color: c, left: l, root: t, right: r} | |
def member(x, tree): | |
if tree == empty: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Use this with something like | |
# Vagrant::Config.run do |config| | |
# config.vm.box = "lucid32" | |
# config.vm.forward_port 22, 2223 | |
# config.vm.forward_port 80, 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Boto simpy works. Fuck Yeah! | |
from boto.emr.connection import EmrConnection | |
from boto.emr.step import JarStep | |
conn = EmrConnection('<Your Key ID>', '<Your Key>') | |
froms3 = JarStep(name='cpfroms3', jar='s3://us-east-1.elasticmapreduce/libs/s3distcp/1.0/s3distcp.jar', step_args=['--src', 's3n://cascastro/','--dest', 'hdfs:///tmp/users/']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
CHUNK = 100 | |
if len(sys.argv) > 1: | |
CHUNK = int(sys.argv[1]) | |
vals = [] | |
i = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import socket | |
import sys | |
import threading | |
import traceback | |
class SocketDumper(threading.Thread): | |
daemon = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C FILE: FIB1.F | |
PROGRAM FIB1 | |
INTEGER X | |
X = 12 | |
WRITE(*,*), FIB(X) | |
END PROGRAM FIB1 | |
FUNCTION FIB(N) | |
C | |
C CALCULATE THE NTH FIBONACCI NUMBER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# See http://cat.pdx.edu/~hunner/git-lg.png for an example | |
lg = "log --decorate --pretty=format:'%C(yellow)%h%C(reset) %C(green)%G?%C(reset) %C(blue)%an%C(reset) %C(cyan)%cr%C(reset) %s %C(auto)%d%C(reset)' --graph --date-order" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function selectvcs() { | |
case `stat -qn -f "%N" $1/.{git,hg}` in | |
*.git) echo "git" ;; | |
*.hg) echo "hg" ;; | |
//./) exit -1 ;; | |
*) $(selectvcs "`dirname ${1}`") ;; | |
esac | |
} | |
$(selectvcs $PWD) $@ |