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
""" | |
A listagent is a factory to conveniently instanstiating sliceagents. | |
A sliceagent can access and mutate an original list "live": it never | |
creates any copy of the original and only refers to it via "address | |
translation" -- normalizing its indices by the size of the original list on | |
every operation. | |
>>> x = [22, 7, 2, -5, 8, 4] | |
>>> listagent(x)[1:].sort() |
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/env python | |
import getpass | |
import os | |
import sys | |
## Application specific | |
SDK_DIR = '/usr/local/google_appengine' | |
APP_DIR = '/home/username/src/app' | |
APPID = 'something-awesome' |
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/env python2.6 | |
""" | |
Usage: python ./rsa_tuples [-s] n | |
Generate `n` RSA tuples using 200-digit primes. | |
Requires: | |
ent.py <http://modular.fas.harvard.edu/ent/ent_py> | |
stream.py <http//github.com/aht/stream.py> |
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 "container/ring" | |
// Use a goroutine to receive values from `out` and store them | |
// in an auto-expanding buffer, so that sending to `out` never blocks. | |
// Return a channel which serves as a sending proxy to to `out`. | |
func sendproxy(out chan<- int) chan<- int { | |
in := make(chan int, 100) | |
go func() { | |
n := 1000 // the allocated length of the circular queue | |
first := ring.New(n) |
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
package main | |
import ( | |
"rand" | |
"time" | |
"flag" | |
"fmt" | |
) | |
func getCoord(rg *rand.Rand) float64 { |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
javascript:(function(){ | |
var importJs=function(jsUrl){ | |
var s=document.createElement("script"); | |
s.setAttribute("src",jsUrl); | |
document.body.appendChild(s); | |
}; | |
importJs("http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"); | |
})(); | |
$('iframe').contents().find('iframe').each(function() { | |
this.contentWindow.onclick = null; |
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
> db['similar_items.tanhxdiv5ratings_cosinesimilarities.6'].count() | |
27745186 | |
> db['similar_items.tanhxdiv5ratings_cosinesimilarities.6'].getIndexes() | |
[ | |
{ | |
"v" : 1, | |
"key" : { | |
"_id" : 1 | |
}, | |
"ns" : "osapi_int.similar_items.tanhxdiv5ratings_cosinesimilarities.6", |
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
""" | |
Automated installation of ejabberd with a postgresql backend inspired by this | |
article: http://www.planeterlang.org/en/planet/article/How_to_install_ejabberd_2.0.0_with_PostgreSQL_support/ | |
""" | |
from fabric.api import run, sudo | |
EJABBERD_VERSION = '2.0.5' | |
EJABBERD_SOURCE_HOME = '~/dev/xmpp/oss' | |
POSTGRES_PSQL_PASSWORD = 'user' |
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
# Based on https://github.com/ansible/ansible/blob/devel/examples/playbooks/postgresql.yml | |
--- | |
- hosts: postgres.vm | |
sudo: yes | |
tasks: | |
- name: ensure latest postgres & postgis packages are latest | |
action: apt pkg=$item update_cache=yes state=latest | |
with_items: |
OlderNewer