Links
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 | |
""" | |
example of using a simple python object to wrap a JSON | |
configuration mapping so that it can be accessed as | |
a python style object using conf.attr1.attr2.value | |
""" | |
CONF = { | |
"CREDENTIALS": { |
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
def post(self): | |
""" | |
Create a new user document in the users and cluster users database. | |
:json string username: required, the requested username | |
:json string password: required, the requested password | |
:json string email: required, and email address to be associated | |
with the account | |
:json string first_name: required, the user's first name | |
:json string last_name: required, the user's last name | |
:json string company: optional, the user's company |
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 | |
""" | |
pyfile_to_module | |
Simple util to convert a python filename like | |
some_package/some_module/some_file.py to some_package.some_module.some_file | |
style module name. | |
""" | |
import argparse |
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 | |
""" | |
Example wordcount and ascii histogram script | |
- Writes a data file in a temporary dir | |
- defines function to parse file into a word iterable | |
- Histogram class that does the word count and draws it as | |
ascii strings with various sorting options | |
Example 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
sudo chmod -R a+rw /usr/local/src | |
mkdir /usr/local/src | |
chmod a+rw -R /usr/local/src | |
curl --remote-name http://www.ijg.org/files/jpegsrc.v9b.tar.gz | |
tar -xzvf jpegsrc.v9b.tar.gz | |
cd jpeg-9b | |
./configure --enable-shared --enable-static | |
make | |
sudo make install | |
sudo ranlib /usr/local/lib/libjpeg.a |
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 | |
# assumes that XCode and XCode command line tools have been installed | |
# xcode-select --install | |
# assumes that gfortran has been installed | |
# https://gcc.gnu.org/wiki/GFortranBinaries | |
# install pyenv & set 2.7.11 as current | |
# See: https://github.com/yyuu/pyenv-installer | |
# See: https://github.com/yyuu/pyenv | |
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash |
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 pandas | |
import numpy | |
# random data with columns A, B, C, D | |
df = pandas.DataFrame(numpy.random.randn(50, 4), columns=list('ABCD')) | |
# | |
# style helpers |
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 | |
""" | |
mock examples | |
""" | |
import os | |
import unittest | |
import mock | |
import functools |