Skip to content

Instantly share code, notes, and snippets.

__author__ = 'arenduchintala'
import sys
import codecs
"""
The following sys setup fixes a lot of issues with writing and reading in utf-8 chars.
WARNING: pdb does not seem to work if you do reload(sys)
"""
reload(sys)
sys.setdefaultencoding('utf-8')
sys.stdin = codecs.getreader('utf-8')(sys.stdin)
import boto.mturk.connection
import boto.mturk.question
sandbox_host = 'mechanicalturk.sandbox.amazonaws.com'
mturk = boto.mturk.connection.MTurkConnection(
aws_access_key_id = 'my aws_access_key_id'
aws_secret_access_key = 'my aws_secret_access_key',
host = sandbox_host,
debug = 2 # debug = 2 prints out all requests. but we'll just keep it at 1
var assert = function (condition, message) {
if (! condition)
throw Error("Assert failed" + (typeof message !== "undefined" ? ": " + message : ""));
}
__author__ = 'arenduchintala'
import json
class MyNode(dict):
def __init__(self, d1, d2, children=None):
dict.__init__(self)
self.__dict__ = self
self.a1 = d1
self.a2 = d2
@arendu-zz
arendu-zz / .screenrc
Last active August 29, 2015 14:19 — forked from joaopizani/.screenrc
# the following two lines give a two-line status, with the current window highlighted
hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
# huge scrollback buffer
defscrollback 5000
# no welcome message
startup_message off
@arendu-zz
arendu-zz / install_stuff.sh
Last active July 27, 2016 18:59
install stuff on aws
sudo apt-get update
sudo apt-get install default-jre
sudo apt-get install default-jdk
wget -O - http://kheafield.com/code/kenlm.tar.gz |tar xz
pushd kenlm
./bjam -j4
popd kenlm
curl http://giza-pp.googlecode.com/files/giza-pp-v1.0.7.tar.gz -o giza-pp-v1.0.7.tar.gz
tar -xzvf giza-pp-v1.0.7.tar.gz
cd giza-pp
perl -pi -w -e 's/<tr1\//</g;' GIZA++-v2/* mkcls-v2/*
perl -pi -w -e 's/using namespace std::tr1;//g;' GIZA++-v2/* mkcls-v2/*
perl -pi -w -e 's/std::tr1:://g;' GIZA++-v2/* mkcls-v2/*
sed '36d' mkcls-v2/mystl.h > mkcls-v2/mystl.h.tmp
sed '50d' mkcls-v2/mystl.h.tmp > mkcls-v2/mystl.h
rm mkcls-v2/mystl.h.tmp
make
@arendu-zz
arendu-zz / numpy-scipy-superpack.sh
Created August 13, 2014 15:22
Numpy & Scipy from superpack
curl -o install_superpack.sh https://raw.githubusercontent.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
sh install_superpack.sh
#see here for more details http://fonnesbeck.github.io/ScipySuperpack/
@arendu-zz
arendu-zz / Vertical Splittling GNU Screen
Last active August 29, 2015 14:03
Vertical Splittling GNU screen mac 0sx 10.9
wget http://serv.menzns.de/blog/downloads/screen.osx.latest
sudo cp screen.osx.latest /usr/bin/screen