View google_style_docstrings.py
# -*- coding: utf-8 -*-
"""Example Google style docstrings.
This module demonstrates documentation as specified by the `Google Python
Style Guide`_. Docstrings may extend over multiple lines. Sections are created
with a section header and a colon followed by a block of indented text.
Example:
Examples can be given using either the ``Example`` or ``Examples``
sections. Sections support any reStructuredText formatting, including
View arc_setup.sh
#!/bin/bash
if [ -z "$1" ]; then
echo -e "Missing 1 parameter: Phabricator URL."
echo -e "ex: arc_setup.sh https://phabricator.mycompany.com"
fi
if ! hash git &> /dev/null || ! hash php &> /dev/null; then
echo -e " *****\n ***** INSTALLING GIT AND PHP\n *****"
sudo apt-get install git-core php5-cli php5-curl
fi
View delete_s3_bucket.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""Delete a S3 bucket with contents.
"""
from __future__ import absolute_import
from gevent import monkey ; monkey.patch_all()
from argparse import ArgumentParser
import boto3
View singletonmixin.py
"""
A Python Singleton mixin class that makes use of some of the ideas
found at http://c2.com/cgi/wiki?PythonSingleton. Just inherit
from it and you have a singleton. No code is required in
subclasses to create singleton behavior -- inheritance from
Singleton is all that is needed.
Singleton creation is threadsafe.
USAGE:
View s3distcp.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""S3DistCp
Run S3DistCp via boto. Currently only a limited set of S3DistCp
options useful for preparing AWS/EMR input data are exposed.
For details of S3DistCp options, see Distributed Copy Using S3DistCP:
http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_s3distcp.html
View decorators.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import functools
import inspect
from itertools import izip_longest
import json
import logging
import os
import sys
from traceback import format_tb
View configure_ec2_instance.sh
#!/usr/bin/bash
#
# For configuring EC2 Debian/Jessie instance.
#
sudo apt-get update
sudo apt-get -y upgrade
################
# general system
View findstr.sh
#!/bin/bash
##############################################################################
# findstr
#
# Search for files containing a specified string. Show the file path,
# line number, and the line itself containing a specified string.
#
# EXAMPLE:
#
# To search for all the files with the file extension .html containing
View ab_test.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""An example of A/B test using the chi-squared test for independence."""
import numpy as np
import pandas as pd
from scipy.stats import chi2_contingency
def main():
data = pd.io.parsers.read_csv('n10000.csv')
View chisq_distribution.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import chi2
def main():
colors = 'bgrcmyk'
n = 40000