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
from cassandra.cluster import Cluster, OperationTimedOut | |
from cassandra.decoder import SyntaxException | |
from tornado.concurrent import Future | |
from tornado.testing import AsyncTestCase, gen_test | |
class TornadoCassandra(object): | |
def __init__(self, session, ioloop): |
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
#!/bin/sh | |
# if you run this for anything other than local tests you are making poor | |
# choices. also, make sure you use safe=True / wc=1 in your tests, or you'll | |
# get consistency issues | |
mongod --nojournal --noprealloc --smallfiles --dbpath /Volumes/RAM\ Disk/ |
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
cat > /etc/apt/preferences.d/backports <<EOF | |
Package: puppet puppet-common puppetmaster facter | |
Pin: release a=lenny-backports | |
Pin-Priority: 900 | |
EOF | |
cat > /etc/apt/sources.list.d/backports.list <<EOF | |
deb http://backports.debian.org/squeeze-backports squeeze-backports main contrib non-free | |
EOF |
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 mogo | |
DBNAME1 = "__testing__" | |
DBNAME2 = "__testing2__" | |
# Basic model | |
class Person(mogo.Model): | |
name = mogo.Field(unicode) | |
# Automatically opens and closes DB connection (or should) |
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
from numpy import array | |
raw_data = """75 | |
95 64 | |
17 47 82 | |
18 35 87 10 | |
20 04 82 47 65 | |
19 01 23 75 03 34 | |
88 02 77 73 07 63 67 | |
99 65 04 28 06 16 70 92 |
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
""" This proves that there was no money under the table. """ | |
import random | |
import sys | |
from collections import Counter | |
def main(): | |
""" Pick one of the sys args """ | |
assert len(sys.argv) > 1 | |
names = sys.argv[1:] |
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
user@localbox:~$ sudo apt-get install x2x | |
# On the remote machine... | |
user@remotebox:~$ sudo apt-get install x2x openssh-server | |
# Download the code from https://gist.github.com/1033384 | |
# and save it to ~/bin on the local machine | |
user@localbox:~$ python bin/mouseporter.py 192.168.1.10 | |
Session started... (type Ctrl-C to quit) | |
# ... and scroll to your right! :) |
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 | |
""" | |
AUTHOR: Josh Marshall | |
ACKNOWLEDGMENTS: Corey(?) http://www.ctrlv.ca/2010/04/163/ | |
REQUIREMENTS: Python 2.6+, x2x, openssh-server | |
This is just a simple script to start an x2x session over SSH | |
on a remote machine. It takes a few parameters (like what side of | |
the screen do you want to use to "cross over" to the other machine, | |
what SSH port / identify file to use, etc. |
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 tornado.httpserver | |
import tornado.ioloop | |
import tornado.web | |
def private(func): | |
# Decorator to make a method, well, private. | |
class PrivateMethod(object): | |
def __init__(self): | |
self.private = True | |
__call__ = func |
NewerOlder