Tyler Hobbs thobbs

View cassandra_leaks.py
1 2 3 4 5 6 7 8 9 10
import resource
import gc
from guppy import hpy
 
 
def print_heap(hp):
h = hp.heap()
strs = []
strs.extend(str(h).split('\n')[1:-1])
for i in range(10):
View multiproc.py
1 2 3 4 5 6 7 8 9
#!/usr/bin/env python
 
import logging
 
log = logging.getLogger()
log.setLevel('INFO')
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s"))
log.addHandler(handler)
View multiproc.py
1 2 3 4 5 6 7 8 9
#!/usr/bin/env python
 
import logging
 
log = logging.getLogger()
log.setLevel('DEBUG')
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s"))
log.addHandler(handler)
View example-utf8.py
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
import logging
 
log = logging.getLogger()
log.setLevel('DEBUG')
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s"))
log.addHandler(handler)
View example.py
1 2 3 4 5 6 7 8 9
#!/usr/bin/env python
 
import logging
 
log = logging.getLogger()
log.setLevel('INFO')
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s"))
log.addHandler(handler)
View .gdbinit
1 2 3 4 5 6 7 8 9 10
# -*- ksh -*-
#
# If you use the GNU debugger gdb to debug the Python C runtime, you
# might find some of the following commands useful. Copy this to your
# ~/.gdbinit file and it'll get loaded into gdb automatically when you
# start it up. Then, at the gdb prompt you can do things like:
#
# (gdb) pyo apyobjectptr
# <module 'foobar' (built-in)>
# refcounts: 1
View gist:5084646
1 2 3 4 5 6 7 8 9
cqlsh:keyspace1> UPDATE mentions SET mentions = 3 WHERE day = '01/05/11' AND item = 'acunu' AND time = 1;
cqlsh:keyspace1> select * from mentions;
 
day | item | time | mentions
----------+-------+------+----------
01/05/11 | acunu | 1 | 3
 
cqlsh:keyspace1> UPDATE mentions SET mentions = 5 WHERE day = '01/05/11' AND item = 'acunu' AND time = 2;
cqlsh:keyspace1> select * from mentions;
View gist:5040362
1 2 3 4 5 6 7 8 9 10
cqlsh> CREATE KEYSPACE keyspace1 WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1' };
cqlsh> use keyspace1;
cqlsh:keyspace1> CREATE TABLE cf3 ( key blob PRIMARY KEY, id varint, postcode text, price varint ) WITH COMPACT STORAGE;
cqlsh:keyspace1> CREATE INDEX cf3_id_idx ON cf3 (id) ;
cqlsh:keyspace1> CREATE INDEX cf3_price_idx ON cf3 (price) ;
cqlsh:keyspace1> DESCRIBE COLUMNFAMILY keyspace1.cf3;
 
CREATE TABLE cf3 (
key blob PRIMARY KEY,
id varint,
View gist:5040355
1 2 3 4 5 6 7 8
<?php
 
require_once(__DIR__.'/lib/autoload.php');
 
use phpcassa\Connection\ConnectionPool;
use phpcassa\ColumnFamily;
use phpcassa\Index\IndexExpression;
use phpcassa\Index\IndexClause;
View gist:4710022
1 2 3 4 5 6 7 8 9
~/pycassa (master)$ ./pycassaShell -k Keyspace1
----------------------------------
Cassandra Interactive Python Shell
----------------------------------
Keyspace: Keyspace1
Host: localhost:9160
 
Available ColumnFamily instances:
* CF1 ( CF1 )
Something went wrong with that request. Please try again.