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 python2.7 | |
# -*- coding: utf-8 -*- | |
"""Biplot example using pcasvd from statsmodels and matplotlib. | |
This is an example of how a biplot (like that in R) can be produced | |
using pcasvd and matplotlib. Additionally, this example does k-means | |
clustering and color observations by which cluster they belong to. | |
""" | |
import matplotlib.pyplot as plt |
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 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 |
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 | |
############################################################################## | |
# 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 |
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/bash | |
# | |
# For configuring EC2 Debian/Jessie instance. | |
# | |
sudo apt-get update | |
sudo apt-get -y upgrade | |
################ | |
# general system |
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 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 |
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
""" | |
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: |
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 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') |
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 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 |
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 | |
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 |
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
# -*- 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 |
OlderNewer