This file contains hidden or 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 numpy as np | |
m = np.matrix([[1, 1], [1, 0]]) | |
def fib(n): | |
return (m ** n)[0, 1] |
This file contains hidden or 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 | |
from __future__ import print_function | |
from hashlib import sha1 | |
from collections import defaultdict | |
import os.path | |
import os | |
def calc_sha(filename, size=256 * 1000 * 1000): |
This file contains hidden or 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 | |
from __future__ import print_function | |
import os | |
import os.path | |
def find_empty_folders(start_dir='.'): | |
for root, dirs, files in os.walk(start_dir): | |
for d in dirs: | |
fulldir = os.path.join(root, d) |
This file contains hidden or 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 | |
from __future__ import print_function | |
from re import compile | |
from abc import abstractmethod | |
from scipy.stats import spearmanr, pearsonr, linregress | |
import numpy as np | |
import matplotlib.pyplot as plt |
This file contains hidden or 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
set -o errexit | |
set -o nounset # same as 'set -u' | |
set -o pipefail | |
# See notes in: | |
# http://www.davidpashley.com/articles/writing-robust-shell-scripts/ |
This file contains hidden or 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
# pip install progressbar2 | |
import time | |
from progressbar import ( | |
ProgressBar, | |
Percentage, Bar, ETA, | |
) | |
values = list(range(1, 10 + 1)) | |
with ProgressBar(widgets=[Percentage(), Bar(), ETA()], max_value=len(values)) as pbar: | |
for i in values: |
This file contains hidden or 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
from os.path import expanduser | |
def match_word(pattern, wordfile=None): | |
wordfile = wordfile or os.path.expanduser("~/Downloads/sowpods.txt") | |
with open(wordfile) as handle: | |
for line in handle: | |
word = line.rstrip().lower() | |
lookup = {c: d for c, d in zip(pattern, word)} | |
if "".join(lookup.get(c, '!') for c in pattern) == word: |
This file contains hidden or 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 | |
from __future__ import print_function | |
import os | |
import sys | |
from collections import defaultdict | |
from fnmatch import fnmatch | |
from pprint import pprint | |
from hashlib import sha1 |
This file contains hidden or 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
(data2) C:\Users\hughdbrown>pip install graphlab-create==1.8 | |
Collecting graphlab-create==1.8 | |
Could not find a version that satisfies the requirement graphlab-create==1.8 (from versions: 2.1) | |
No matching distribution found for graphlab-create==1.8 | |
(data2) C:\Users\hughdbrown>pip install graphlab-create==1.8.3 | |
Collecting graphlab-create==1.8.3 | |
Could not find a version that satisfies the requirement graphlab-create==1.8.3 (from versions: 2.1) | |
No matching distribution found for graphlab-create==1.8.3 |
This file contains hidden or 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 bash -e | |
export image_version="2.0.1" | |
export image_name="datafellas/distributed-pipeline-quotes:${image_version}" | |
sudo docker pull ${image_name} | |
sudo docker run --rm -it \ | |
--memory=8g \ | |
--cpuset-cpus="0-3" \ |