Skip to content

Instantly share code, notes, and snippets.

from boto.emr.connection import EmrConnection
from boto.emr.step import InstallPigStep, PigStep
AWS_ACCESS_KEY = '' # REQUIRED
AWS_SECRET_KEY = '' # REQUIRED
conn = EmrConnection(AWS_ACCESS_KEY, AWS_SECRET_KEY)
pig_file = 's3://elasticmapreduce/samples/pig-apache/do-reports2.pig'
INPUT = 's3://elasticmapreduce/samples/pig-apache/input/access_log_1'
OUTPUT = '' # REQUIRED, S3 bucket for job output
@six5532one
six5532one / gist:6197080
Created August 9, 2013 20:50
Zipf's Law of the Internet
import matplotlib.pyplot as plt
import pylab
import numpy as np
import math
import csv
import random
import datetime
import pymongo
from random import randint, uniform
@six5532one
six5532one / gist:6201787
Created August 10, 2013 19:25
Examples to clarify two ways of setting object properties
When to use @property decorators?
you start off a class like this
(A)
class Example(object):
def __init__(self, age):
self.age = age
later, you realize I don't really want to store age
I want to store birth_year and calculate age dynamically
so, you can rewrite like this

Keybase proof

I hereby claim:

  • I am six5532one on github.
  • I am emily_chen (https://keybase.io/emily_chen) on keybase.
  • I have a public key whose fingerprint is 005A C09C 075C C64D 4C93 B772 2989 1457 0E66 F0BC

To claim this, I am signing this object:

/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java -Dakka.loglevel=DEBUG -Dakka.actor.debug.receive=on "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=65435:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/