Skip to content

Instantly share code, notes, and snippets.

@bwhite
bwhite / README.rst
Last active December 19, 2015 03:39

@glassask

Operation

A glass user sends a question with an optional location (sent if their question starts with "where") and option picture. @glassask multiplexes many glass users and this is invisible to annotators (not necessarily true that the same glass user is posting the tweets). When a reply is made from twitter it is parsed (see Tweet parsing below) and sent to the originating user's glass (i.e., whoever asked the question).

Tweets

Include paths
C:\Users\Administrator\Desktop\picarus-deps\pthreads\include;C:\Users\Administrator\Desktop\picarus-deps\fftw3;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\videostab;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\world\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\video\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\ts\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\superres\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\stitching\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\python\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\ocl\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\nonfree\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\legacy\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\java\include;C:\Users\Administrator\Desktop\picarus-deps\opencv\modules\photo\include;C:\Users\Administrat
import sklearn.svm
import random
import numpy as np
if 0:
import kernels
kernel = kernels.histogram_intersection
else:
kernel = lambda x, y: np.dot(x, y.T)
# Closures + Generators: Check yourself before you wreck yourself
def outer():
for x in range(10):
a = x
def inner():
print(a)
yield inner
# Sequential call, can't tell anything is wrong
@bwhite
bwhite / data_sources.py
Created November 12, 2012 17:51
Standardized data source interface
import os
import re
import urllib
def data_source_from_uri(data_source_path):
try:
data_source_path, query_string = data_source_path.split('?', 1)
except ValueError:
columns = {}
@bwhite
bwhite / wc.py
Created September 23, 2012 12:05
Hadoopy Workcount
import hadoopy
def mapper(key, value):
# Split line into words
for word in value.split():
yield word, 1
def reducer(key, values):
yield key, sum(values)
@bwhite
bwhite / crawl.py
Created September 23, 2012 10:22
Gevent Crawler Demo
from gevent import monkey, spawn, joinall
monkey.patch_all() # Magic!
import re, requests, random
URLS = set(['http://umd.edu', 'http://nytimes.com'])
def crawl(urls):
try:
while True:
url = random.choice(list(urls))
URLS.add(url)
print(url)
@bwhite
bwhite / demo.sh
Created September 23, 2012 09:26
ZMQ Pub/Sub Example
python zmq_client_sub.py &
python zmq_client_sub.py &
python zmq_server_pub.py
@bwhite
bwhite / hbase_bench.txt
Created September 22, 2012 21:33
Machine benchmark
http://wiki.apache.org/hadoop/Hbase/PerformanceEvaluation