Skip to content

Instantly share code, notes, and snippets.

from pymongo import Connection
import urllib
import simplejson
response = simplejson.load(urllib.urlopen("http://search.twitter.com/search.json?q=test"));
tweets = response["results"];
db = Connection().map_reduce_example
for tweet in tweets:
theArrayList.toArray(new String[theArrayList.size()]);
/usr/lib/ruby/gems/1.8/gems/rb-inotify-0.8.1/lib/rb-inotify/notifier.rb:232:in `read_events': uninitialized constant INotify::Notifier::EINVAL (NameError)
from /usr/lib/ruby/gems/1.8/gems/rb-inotify-0.8.1/lib/rb-inotify/notifier.rb:215:in `process'
from /usr/lib/ruby/gems/1.8/gems/rb-inotify-0.8.1/lib/rb-inotify/notifier.rb:198:in `run'
from /usr/lib/ruby/gems/1.8/gems/fssm-0.1.4/lib/fssm/backends/inotify.rb:20:in `run'
from /usr/lib/ruby/gems/1.8/gems/fssm-0.1.4/lib/fssm/monitor.rb:24:in `run'
from /usr/lib/ruby/gems/1.8/gems/fssm-0.1.4/lib/fssm.rb:17:in `monitor'
from ./bin/../lib/warmonger/filewatcher.rb:23:in `watch'
@ajkovar
ajkovar / gist:1128465
Created August 5, 2011 20:41
scala regex
var r = new Regex("(.*)\\?(.*)")
req.getUri match {
case r(url, params) => // one thing
case _ => // other thing
}
@ajkovar
ajkovar / gist:1160841
Created August 21, 2011 16:53
placeholders
def f = println("hi")
val f2 = f _ // partially applies it
f() // hi
f2() // hi
val f = () => println("hi")
val f2 = f _ // wraps it in a function
f() // hi
f2()() // hi
@ajkovar
ajkovar / scrabble.rb
Created January 20, 2012 18:10
hack night
DICTIONARY =
[
"amalar",
"noema",
"clemiso",
"hidromuria",
"ambonio",
"sustalo",
"incopelusa",
"novalo",
(require 'package)
(require 'cl)
(dolist (source '(("elpa" . "http://tromey.com/elpa/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(add-to-list 'package-archives source t))
;; (add-to-list 'package-archives
;; '("melpa" . "http://melpa.milkbox.net/packages/") t)
(setq package-user-dir (expand-file-name "elpa" (file-name-directory load-file-name)))
sudo apt-get install libgtk-3-dev libxpm-dev libjpeg-dev libgif-dev libtiff4-dev libncurses5-dev
#!/bin/bash
# needed for compiling emacs
sudo apt-get install -y libgtk-3-dev libxpm-dev libjpeg-dev libgif-dev libtiff4-dev libncurses5-dev qjackctl qsynth
# misc
sudo apt-get install -y aptitude rlwrap grc
# work
sudo apt-get install -y mysql-server git git-gui openjdk-7-jdk openjdk-6-jdk curl
# 'ag' command - search for text
sudo apt-get install silversearcher-ag