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 script to demonstrate the idea that starting at a multiple of 9 and dividing by 2 | |
will yield digits that add up to 9""" | |
import sys | |
from decimal import * | |
DEFAULT_STARTING_VALUE = 360 | |
DECIMAL_PRECISION = 255 |
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 | |
"""Sample the modem's signal | |
This script is meant to be run with the Motorola SB6121 Surfboard Modem. | |
If you run it on a different modem, it might not work, but it's worth a try... | |
It should be run as a cron job, every minute (or whatever interval you'd like) | |
into a text file. The file can later be used by a json parser to analyze the | |
signal over time, which can be used to come to conclusions that you can argue |
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
class MemoryProfiler: | |
def mem(self, size="rss"): | |
"""Generalization; memory sizes: rss, rsz, vsz.""" | |
return os.popen('ps -p %d -o %s | tail -1' % (os.getpid(), size)).read() | |
def rss(self): | |
"""Return ps -o rss (resident) memory in kB.""" | |
return self.convert_kilobytes(self.mem("rss")) |
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 | |
"""Copy two riak buckets""" | |
import sys | |
from optparse import OptionParser | |
import fileinput | |
import logging | |
from riak import RiakClient | |
from multiprocessing import Pool |
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/bash | |
# Get time limit (default is 60 seconds) | |
if [ $1 == "-t" ]; then | |
shift | |
time_limit=$1 | |
shift | |
else | |
time_limit=60 | |
fi |
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 sys | |
from optparse import OptionParser | |
from urlparse import urljoin | |
import urllib2 | |
import json | |
DEFAULT_RIAK_URL = "http://localhost:8098/" |