Skip to content

Instantly share code, notes, and snippets.

View jhamrick's full-sized avatar

Jessica B. Hamrick jhamrick

View GitHub Profile
@jhamrick
jhamrick / enigma.py
Last active December 29, 2015 01:18 — forked from ivanov/enigma.py
# A template to demonstrate why we need to profile
# This instance written by Paul Ivanov (XXX: put your name / github id here)
import numpy as np
import random
def where_is_the_bottleneck(x):
return [random.randint(0, 100) for i in xrange(x)]
@jhamrick
jhamrick / convert_cpo_to_sso.py
Last active December 21, 2015 21:39
Convert "towers of blocks" CPO files to SSO files.
"""Convert 'tower of blocks' CPO files to SSO files."""
# Standard
import os
import re
import colorsys
import sys
import pickle
# External
from path import path
import numpy as np
@jhamrick
jhamrick / indices.ipynb
Created July 7, 2013 19:35
Timing various methods of constructing list combinations.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def update_docstring(name, olddoc):
# make sure it has a docstring
if olddoc is None:
return None
# new docstring
prefix = "%s: " % name
if len(olddoc.split(": ")) > 1:
newdoc = prefix + olddoc.split(": ")[1]
else:
@jhamrick
jhamrick / omnigraffle-export_app_name.patch
Created April 15, 2013 23:58
omnigraffle-export: look for OmniGraffle Professional 5 if OmniGraffle 5 does not exist
From 1ebff43a47eea78643a903d85b13c91eb94d1e76 Mon Sep 17 00:00:00 2001
From: "Jessica B. Hamrick" <jhamrick@berkeley.edu>
Date: Mon, 15 Apr 2013 16:51:38 -0700
Subject: [PATCH] Look for OmniGraffle Professional 5 if OmniGraffle 5 does not
exist
---
omnigraffle_export/omnigraffle.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
import requests as req
import pandas as pd
import dotenv
import os
import json
import subprocess as sp
from time import mktime
from datetime import datetime
from collections import OrderedDict
@jhamrick
jhamrick / default.html
Created August 20, 2015 16:04
psiTurk default.html that generates random debug links
<!doctype html>
<html>
<head>
<title>CompCog Psychology Experiment</title>
<script src="static/lib/jquery.min.js" type="text/javascript"></script>
<script src="static/lib/bootstrap.min.js"></script>
<link rel="stylesheet" href="static/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="static/css/general.css" media="screen" />
</head>
@jhamrick
jhamrick / introduction.ipynb
Created July 23, 2015 16:19
Introduction to the IPython Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhamrick
jhamrick / progress.py
Created June 22, 2015 22:27
Progress
import sys
from datetime import datetime, timedelta
try:
from IPython.display import clear_output
except ImportError:
clear_output = None
class Progress(object):
@jhamrick
jhamrick / assign_qualification.py
Created August 4, 2014 22:11
Assign qualifications on amazon turk
#!/usr/bin/env python
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from boto.mturk.connection import MTurkConnection
import os
if __name__ == "__main__":
parser = ArgumentParser(
formatter_class=ArgumentDefaultsHelpFormatter)