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
# fix_networking.sh | |
# | |
# This script automates the steps outlined at: | |
# | |
# http://weblog.jamisbuck.org/2008/8/15/cloning-ubuntu-hardy-image-in-vmware-fusion | |
# | |
# for fixing the networking on a copied Ubuntu VMWare image. | |
usage() { | |
cat <<EOF |
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 | |
"""Synchronizes bookmarks from http://pinboard.in/ | |
""" | |
import base64 | |
import datetime | |
import sys | |
import urllib2 | |
from appscript import * |
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
public class RepartitionMapper extends MapReduceBase | |
implements Mapper<LongWritable, Text, ApacheKeyWritable, Text> { | |
private static final Log LOG = LogFactory.getLog(RepartitionMapper.class); | |
private static ApacheKeyWritable outputKey = new ApacheKeyWritable(); | |
public MatchResult parseInputFilename(String filename) | |
throws IllegalArgumentException { | |
Pattern p = Pattern.compile( |
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 org.apache.hadoop.hbase.HBaseTestingUtility; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class HBaseTest { | |
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); | |
@BeforeClass | |
public static void setUpBeforeClass() throws Exception { | |
TEST_UTIL.startMiniCluster(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
[junit] Failed construction of Master: class org.apache.hadoop.hbase.MiniHBaseCluster$MiniHBaseClusterMastercom.google.common.collect.ImmutableList.copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableList; | |
[junit] java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.MiniHBaseCluster$MiniHBaseClusterMastercom.google.common.collect.ImmutableList.copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableList; | |
[junit] at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1166) | |
[junit] at org.apache.hadoop.hbase.LocalHBaseCluster.<init>(LocalHBaseCluster.java:112) | |
[junit] at org.apache.hadoop.hbase.MiniHBaseCluster.init(MiniHBaseCluster.java:232) | |
[junit] at org.apache.hadoop.hbase.MiniHBaseCluster.<init>(MiniHBaseCluster.java:71) | |
[junit] at org.apache.hadoop.hbase.HBaseTestingUtility.startMiniCluster(HBaseTestingUtility.java:293) | |
[junit] at com.wolfram.ca.jobs.sessions.SessionsHBaseTest.setUpBeforeClass |
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 urllib2 | |
def file_exists(location): | |
request = urllib2.Request(location) | |
request.get_method = lambda : 'HEAD' | |
try: | |
response = urllib2.urlopen(request) | |
return True | |
except urllib2.HTTPError: | |
return False |
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 | |
# | |
# Script to initiate (or connect to) a single node Hadoop cluster in a | |
# tmux session. Requires that tmux and hadoop are on your path. | |
SESSION=hadoop | |
tmux has-session -t $SESSION | |
if [ $? -eq 0 ]; then | |
echo "Session $SESSION already exists. Attaching." |
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 | |
# .NEF (Nikon Electronic Format) headers | |
SIGNATURE = '\x4d\x4d\x00\x2a\x00\x00\x00\x08\x00' | |
def read_chunks(stream, overlap = len(SIGNATURE), size = 100 * 2 ** 20): | |
'''Read chunks from the stream with a small overlap.''' | |
data = stream.read(size) | |
while 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
# Install the awesome ggplot graphics library | |
install.packages("ggplot2") | |
# Read in the data file, assuming a CSV and a header line | |
running <- read.table("running.csv", sep=",", header=TRUE) | |
# Plot! | |
ggplot(running, aes(x = as.Date(date), ymin = 0, ymax = ounces)) + geom_linerange() |
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 csv | |
import math | |
import random | |
import sys | |
import numpy | |
NUMBER_OF_LEVERS = 10 |
OlderNewer