85 >>> def test():
for _ in xrange(1000000):
uuid.uuid1()
...:
; This is ~/.clojure/repl-init.clj | |
; | |
; I start a clojure repl something like: | |
; | |
; rlwrap --remember --complete-filenames \ | |
; --history-filename ~/.clojure/history \ | |
; --break-chars "\"\\'(){}[],^%$#@;:|" \ | |
; java -server -cp 'src/:lib/*' clojure.main \ | |
; -i ~/.clojure/repl-init.clj |
data = { | |
1 : {1.1: "data", | |
1.2: "data", | |
1.3: "data", | |
1.4: "data", | |
1.5: "data"}, | |
2 : {2.1: "data", | |
2.2: "data", | |
2.3: "data", | |
2.4: "data", |
MyObjs(Standard) | |
---------------- | |
row_key => {ts: 1234, | |
host: "kremvax", | |
attr1: data, | |
attr2: data, | |
attr2: data} | |
MyObjsIndices(Super) | |
-------------------- |
Simple string | |
------------- | |
>>> s='foo bar baz' | |
>>> %timeit str(s) | |
1000000 loops, best of 3: 214 ns per loop | |
import time | |
class TtlDict(dict): | |
"""A dict where values expire after a set time. | |
Expiration is done on access, or using `prune` (linear)""" | |
ttl = 5 | |
def __init__(self, *args, **kwargs): | |
dict.__init__(self, *args, **kwargs) |
import sys | |
import termios | |
import time | |
import tty | |
def wait_space(): | |
if sys.stdin.read(1) == ' ': | |
return time.time() | |
return wait_space() |
First revision (Secondary Index) | |
================================== | |
Store objects in one CF, and index in another. | |
Note: In Cassandra 0.7, using a secondary index for columns id:google, id:fb, id:myspace would eliminate the need for UserIndex. | |
Users | |
------ | |
"e0ee3406d83c11dfa47e002219990fd7": { |
""" | |
$ cat testar.thrift | |
struct Testar { | |
1: i32 heltal = 42, | |
2: optional string texten, | |
3: optional string mertext = 'foo', | |
4: optional map<string,string> properties | |
} |
ZOO_LOG4J_PROP="INFO,ROLLINGFILE" | |
ZOO_LOG_DIR="/var/log/zookeeper/" |