This file contains hidden or 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
# -*- 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 |
This file contains hidden or 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 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) |
This file contains hidden or 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 | |
# -*- 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) |
This file contains hidden or 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 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) |
This file contains hidden or 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 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) |
This file contains hidden or 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 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): |
This file contains hidden or 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
#! /bin/bash | |
while true; do | |
echo "stopping node1" | |
./ccm node1 stop | |
sleep 1 | |
echo "starting node1" | |
./ccm node1 start |
This file contains hidden or 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/python | |
import sys | |
HEADER = "||branch||testall||dtest||" | |
BRANCH_TEMPLATE = "[{branch}|https://github.com/{username}/cassandra/tree/{branch}]" | |
TESTALL_TEMPLATE = "[testall|http://cassci.datastax.com/view/Dev/view/{username}/job/{username}-{branch}-testall]" | |
DTEST_TEMPLATE = "[dtest|http://cassci.datastax.com/view/Dev/view/{username}/job/{username}-{branch}-dtest]" | |
ROW_TEMPLATE = "|" + BRANCH_TEMPLATE + "|" + TESTALL_TEMPLATE + "|" + DTEST_TEMPLATE + "|" |
This file contains hidden or 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
(let [; pick random points for a "line of reflection" | |
reflection-start-x (random (w 0.0) (w 0.5)) | |
reflection-start-y (random (h 0.5) (h 1.0)) | |
reflection-end-x (random (w 0.5) (w 1.0)) | |
reflection-end-y (random (h 0.0) (h 0.5)) | |
x-spread (- reflection-end-x reflection-start-x) | |
y-spread (- reflection-end-y reflection-start-y) | |
max-spread (max x-spread y-spread) |
This file contains hidden or 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 sys | |
import lxml.etree as le | |
def main(filename): | |
with open(filename, 'r+b') as f: | |
doc = le.parse(f) | |
# strip border strokes | |
for elem in doc.xpath('//*[attribute::style]'): | |
if 'stroke:none' in elem.attrib['style']: |