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
[core] | |
editor = mvim -f | |
ui = true | |
excludesfile = /Users/benjamin/.gitignore | |
[user] | |
name = Benjamin Bengfort | |
email = benjamin@bengfort.com | |
[diff] | |
external = /Users/benjamin/bin/godiff.sh | |
[credential] |
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 | |
import time | |
def search_steps(Z, factor=10, verbose=True): | |
""" | |
Finds the number you're looking for. | |
""" | |
# Initialize internal variables |
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 | |
USER=$PGUSER | |
HOST=$PGHOST | |
NAME=$PGDATABASE | |
BUCKET="s3://cobrainabsolem/datadumps/productdb/" | |
main() { | |
if [ "$#" == "0" ]; then | |
echo "Please supply a filename for the dump" |
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 | |
# baby_search | |
# Executes regular expression queries on CPS | |
# | |
# Author: Benjamin Bengfort <benjamin@bengfort.com> | |
# Created: Mon Mar 03 09:56:09 2014 -0500 | |
# Requires: psycopg2 | |
# | |
# ID: baby_search.py [] benjamin@bengfort.com $ |
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
select | |
round(100.0 * (SUM(CASE WHEN probability > 0.95 THEN 1 ELSE 0 END) / count(id)::float)::numeric, 3) as pcnt_95, | |
round(100.0 * (SUM(CASE WHEN probability > 0.90 THEN 1 ELSE 0 END) / count(id)::float)::numeric, 3) as pcnt_90, | |
round(100.0 * (SUM(CASE WHEN probability > 0.85 THEN 1 ELSE 0 END) / count(id)::float)::numeric, 3) as pcnt_85, | |
round(100.0 * (SUM(CASE WHEN probability > 0.80 THEN 1 ELSE 0 END) / count(id)::float)::numeric, 3) as pcnt_80, | |
round(100.0 * (SUM(CASE WHEN probability > 0.75 THEN 1 ELSE 0 END) / count(id)::float)::numeric, 3) as pcnt_75, | |
round(100.0 * (SUM(CASE WHEN probability > 0.70 THEN 1 ELSE 0 END) / count(id)::float)::numeric, 3) as pcnt_70, | |
round(100.0 * (SUM(CASE WHEN probability > 0.65 THEN 1 ELSE 0 END) / count(id)::float)::numeric, 3) as pcnt_65, | |
round(100.0 * (SUM(CASE WHEN probability > 0.60 THEN 1 ELSE 0 END) / count(id)::float)::numeric, 3) as pcnt_60 | |
from annotated_products; |
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 | |
import os | |
import sys | |
import nltk | |
import argparse | |
import unicodecsv as csv | |
from operator import itemgetter | |
PATH = os.path.normpath(os.path.join(os.path.dirname(__file__), 'cloze_output.txt')) |
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
Food | Measure | Weight (g) | kCal | Fat (g) | Carbo(g) | Protein (g) | |
---|---|---|---|---|---|---|---|
Source:USDA Nutrient Database for Standard Reference | Release 12 | Pocket v1.1 | www.nal.usda.gov/fnic/foodcomp | ||||
1000 Island,Salad Drsng,Local | 1 Tbsp | 15 | 25 | 2 | 2 | 0 | |
1000 Island,Salad Drsng,Reglr | 1 Tbsp | 16 | 60 | 6 | 2 | 0 | |
40% Bran Flakes,Kellogg's | 1 oz | 28.35 | 90 | 1 | 22 | 4 | |
40% Bran Flakes,Post | 1 oz | 28.35 | 90 | 0 | 22 | 3 | |
Alfalfa Seeds,Sprouted,Raw | 1 Cup | 33 | 10 | 0 | 1 | 1 | |
All-Bran Cereal | 1 oz | 28.35 | 70 | 1 | 21 | 4 | |
Almonds,Slivered | 1 Cup | 135 | 795 | 70 | 28 | 27 | |
Almonds,Whole | 1 oz | 28.35 | 165 | 15 | 6 | 6 |
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
mongoexport --db cps --collection products --journal | gzip -9 > fixtures/products.json.gz |
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
SELECT product.id, product.name, product.description, | |
coalesce(product.image, product.affiliate_image, product.thumbnail, product.affiliate_thumbnail) as image, | |
product.gender, product.age, category.name as original_category, | |
'' as label, '' as probability, '' as sublabel, '' as subprobability, | |
product.created, product.updated | |
FROM product | |
LEFT JOIN category on category.id = product.category_id | |
--LIMIT 10 | |
; |
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 | |
# Dumps the Mongo Database and exports it to S3 | |
# Make sure to run this script in the background! (nohup) | |
WORKING_DIRECTORY="/mnt/vol-604be929/tmp/data" | |
if [ ! -d "$WORKING_DIRECTORY" ]; then | |
mkdir -p $WORKING_DIRECTORY | |
fi |
OlderNewer