Skip to content

Instantly share code, notes, and snippets.

View jhamrick's full-sized avatar

Jessica B. Hamrick jhamrick

View GitHub Profile
@jhamrick
jhamrick / About koans
Created April 10, 2014 05:10
This is a proof-of-concept for writing Python koans (https://github.com/gregmalcolm/python_koans) in an IPython notebook, based on the original about_strings.py (https://github.com/gregmalcolm/python_koans/blob/master/python2/koans/about_strings.py) koan.
{
"metadata": {
"name": "",
"signature": "sha256:68dde4e98d73981470a2678c04c4a291b230afea11aa551a38bac92ec836e42e"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@jhamrick
jhamrick / keep_assigning_hits.py
Created June 11, 2014 04:03
Extend HITs as assignments are completed
#!/usr/bin/env python
"""Extend HITs as assignments are completed.
If a HIT takes up a lot of bandwidth, then you may only want to have a
few workers doing it at a time. This script monitors how many
assignments are currently being worked on, and as they are completed,
extends the HIT with new assignments until a specified upper limit is
reached.
@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)
@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 / 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 / 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>
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 / 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(-)
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 / 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.