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
"""Query AlchemyAPI to determine number of API calls still available""" | |
# -*- coding: utf-8 -*- | |
import json | |
import requests | |
def get_api_key(): | |
# Load API key (40 HEX character key) from local file | |
key = open('api_key.txt').readline().strip() | |
return key |
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/sh | |
echo "Starting mongo" | |
mongod --config=./mongodb.conf & | |
sleep 2 | |
# tail the log named in the config file | |
LOG_PATH=`grep -o "^logpath=.*" mongodb.conf | cut -b 9-` | |
echo "Tailing" $LOG_PATH | |
tail -f $LOG_PATH |
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
"""Hackish script to convert a notebook into | |
Note that the content of markdown cells is not translated: it is assumed to | |
hold asciidoc content instead (even if it does not render correctly in the | |
browser editing the notebook file). | |
This script could be improved to use pandoc to handle the conversion instead. | |
Sample 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
# take a bootstrap sample to calculate CI on counts of items | |
def bootstrap_sample_on_array(items, quantiles=[0.025, 0.975], n_bootstrap_samples = 1000): | |
all_counts = [] | |
for n in range(n_bootstrap_samples): | |
sample_ids = np.random.randint(low=0, high=items.shape[0], size=items.shape[0]) | |
sample = items[sample_ids] | |
uniq, cnts = np.unique(sample, return_counts=True) | |
c = dict(zip(uniq, cnts)) | |
all_counts.append(c) | |
all_counts = pd.DataFrame(all_counts).fillna(0) |