This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lxml.html | |
import urllib2 | |
import urllib | |
import cookielib | |
import re | |
class ScraperException(Exception): | |
pass | |
class Page(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
import lxml, lxml.etree, urllib2, re | |
SESSYR=2012 | |
SESSCD='W' | |
debug_last_url = None | |
def read_endpoint(dept=None, course=None, section=None): | |
global SESSYR, SESSCD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
import subprocess | |
from collections import defaultdict | |
from glob import glob | |
import sys | |
pattern = sys.argv[1] | |
d = defaultdict(lambda: []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'brendan' | |
__all__ = ['logfloat', 'LogFloat'] | |
import numpy as np # numpy's logaddexp correctly handles LOGZERO | |
from math import log as _log, exp as _exp | |
@np.vectorize | |
def logfloat(x): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
__author__ = 'brendan' | |
import collections | |
class property_dict(collections.Mapping): | |
""" | |
Dictionary wrapper that adapts a dict with a wrapper allowing property-style reads. Intended | |
for ease of JSON accessing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Google Directions API | |
""" | |
import urllib2 | |
import urllib | |
import json | |
class Modes: | |
DRIVING="driving" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################## | |
# install Torch | |
# export PREFIX=/home/scratch/$USER/torch | |
export PREFIX="/home/scratch/torchshared/torch" | |
mkdir -p $PREFIX | |
rm -rf /tmp/luajit-rocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ An implementation of L-BFGS, heavily inspired by minFunc (Mark Schmidt) | |
This implementation of L-BFGS relies on a user-provided line | |
search function (state.lineSearch). If this function is not | |
provided, then a simple learningRate is used to produce fixed | |
size steps. Fixed size steps are much less costly than line | |
searches, and can be useful for stochastic problems. | |
The learning rate is used even when a line search is provided. | |
This is also useful for large-scale stochastic problems, where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function arxiv-authors() { | |
if [ $# -ne 1 ]; then | |
echo "Usage: arxiv-authors arxiv_url_or_id" | |
echo "Prints authors' names, one per line." | |
else | |
if [[ $1 == http* ]]; then | |
url=$1 | |
else | |
url=http://arxiv.org/abs/$1 | |
fi |
OlderNewer