Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kachok's full-sized avatar

Dmitry Kachaev kachok

View GitHub Profile
@kachok
kachok / survey.html
Created March 21, 2012 01:15
HTML+JS for embedding Language Survey into MTurk questions
<!--
HTML+JS for embedding Language Survey into MTurk questions
Licensed under MIT/CC BY-SA 3.0 license
Use: replace FOREIGN with the name of foreign language
Requires JQuery library loaded in HEAD:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
@kachok
kachok / turk.js
Created March 20, 2012 20:08 — forked from longouyang/turk.js
Small helper file for doing external HITs on Mechanical Turk
var turk = {};
(function() {
var param = function(url, name ) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return ( results == null ) ? "" : results[1];
}
@kachok
kachok / gist:1674638
Created January 25, 2012 04:03
Stats on bikes "hidden" moves in CaBi data
# "hidden" move - bike move started in bike station, different from the one where bike was actually left in previous trip
# 0 ['Duration', 'Start date', 'End date', 'Start station', 'End station', 'Bike#', 'Member Type']
# 1 ['0h 7min. 48sec.', '12/31/2011 23:55', '1/1/2012 0:03', '18th & M St NW (31221)', '10th & U St NW (31111)', 'W01319', 'Registered']
f=open ("2011-1st-quarter.csv")
tracking={}
member_types={}
total=0
@kachok
kachok / gist:1376975
Created November 18, 2011 16:35 — forked from defnull/gist:1224387
Deploy a Bottle app on Heroku
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
import bottle
import os
@kachok
kachok / listing.py
Created July 29, 2011 17:11
Quick and dirty way to get 1.usa.gov click archive
import urllib
import re
import time
data = urllib.urlopen('http://bitly.measuredvoice.com/bitly_archive/?C=M;O=D').read()
#print data
#datafiles name pattern - usagov_bitly_data2011-07-29-1311919454