Skip to content

Instantly share code, notes, and snippets.

@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 / custom.css
Last active October 7, 2020 15:34
IPython customizations
/* Solarized color pallet */
.solarized.base03 { color: #002b36; }
.solarized.base02 { color: #073642; }
.solarized.base01 { color: #586e75; }
.solarized.base00 { color: #657b83; }
.solarized.base0 { color: #839496; }
.solarized.base1 { color: #93a1a1; }
.solarized.base2 { color: #eee8d5; }
.solarized.base3 { color: #fdf6e3; }
.solarized.solar-yellow { color: #b58900; }
@jhamrick
jhamrick / genkeys.sh
Last active January 17, 2024 07:33
Generate SSL certificates with IP SAN
#!/usr/bin/env bash
#
# Generate a set of TLS credentials that can be used to run development mode.
#
# Based on script by Ash Wilson (@smashwilson)
# https://github.com/cloudpipe/cloudpipe/pull/45/files#diff-15
#
# usage: sh ./genkeys.sh NAME HOSTNAME IP
set -o errexit
@jhamrick
jhamrick / passenger_wsgi.py
Last active December 30, 2019 22:35
Passenger configuration for psiTurk on DreamHost
import sys
import os
import logging
from logging.handlers import RotatingFileHandler
# This script assumes you have created a subdomain on DreamHost
# that is configured for Passenger. It also assumes you have created
# a Python virtual environment in the root of that subdomain and
# installed psiTurk inside it.
@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
Loading
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 / return_feedback.py
Created October 9, 2015 19:46
Return nbgrader feedback to students
"""Return feedback to students that was generated with `nbgrader feedback`.
This must be run from the root of the nbgrader directory. You probably need to run
it with sudo since you need to write to other users' directories.
Usage:
sudo python return_feedback.py problem_set_name
"""
@jhamrick
jhamrick / Dockerfile
Last active April 11, 2020 16:27
nbgrader docker image
FROM jupyter/notebook
# Install nbgrader
RUN pip2 install nbgrader && pip3 install nbgrader
# Add any other dependencies you might want, e.g. numpy, scipy, etc.
#RUN pip2 install numpy scipy matplotlib
#RUN pip3 install numpy scipy matplotlib
# Configure grader user