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
<?php | |
class base58 | |
{ | |
static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"; | |
public static function encode($int) { | |
$base58_string = ""; | |
$base = strlen(self::$alphabet); | |
while($int >= $base) { |
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
<?php | |
/** | |
* UUID class | |
* | |
* The following class generates VALID RFC 4122 COMPLIANT | |
* Universally Unique IDentifiers (UUID) version 3, 4 and 5. | |
* | |
* UUIDs generated validates using OSSP UUID Tool, and output | |
* for named-based UUIDs are exactly the same. This is a pure | |
* PHP implementation. |
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 os | |
def split(filehandler, delimiter=',', row_limit=10000, | |
output_name_template='output_%s.csv', output_path='.', keep_headers=True): | |
""" | |
Splits a CSV file into multiple pieces. | |
A quick bastardization of the Python CSV library. | |
Arguments: |
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
//run this script after jQuery loads, but before jQuery Mobile loads | |
//customize jQuery Mobile to let IE7+ in (Mobile IE) | |
$(document).bind("mobileinit", function(){ | |
$.extend( $.mobile , { | |
//extend gradeA qualifier to include IE7+ | |
gradeA: function(){ | |
//IE version check by James Padolsey, modified by jdalton - from http://gist.github.com/527683 | |
var ie = (function() { |
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 math | |
import random | |
class Statistic(object): | |
""" | |
Hookin' it up with the seven descriptive statistics. | |
""" | |
def __init__(self, sample): |
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 | |
__description__ = 'Get the MDL list and search a blob' | |
__author__ = 'Brandon Dixon' | |
__version__ = '1.0' | |
__date__ = '2011/19/01' | |
import optparse | |
import os |
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 unittest | |
class StepCollection(object): | |
def __setattr__(self, attr, val): | |
if hasattr(self, attr): | |
raise RuntimeError("step %s is already declared!" % (attr,)) | |
return super(StepCollection, self).__setattr__(attr, val) | |
class Object(object): pass | |
class World(unittest.TestCase): | |
def __init__(self): |
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
__description__ = 'Convert VT format to a user-friendly format' | |
__author__ = 'Brandon Dixon' | |
__version__ = '1.0' | |
__date__ = '2011/03/21' | |
import simplejson as json | |
import urllib | |
import urllib2 | |
import hashlib |
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
def diskstats(): | |
file_path = '/proc/diskstats' | |
# http://lxr.osuosl.org/source/Documentation/iostats.txt | |
columns_disk = ['major_dev_num', 'minor_dev_num', 'device', 'reads', 'reads_merged', 'sectors_read', 'ms_reading', 'writes', 'writes_merged', 'sectors_written', 'ms_writing', 'current_ios', 'ms_doing_io', 'weighted_ms_doing_io'] | |
columns_partition = ['major_dev_num', 'minor_dev_num', 'device', 'reads', 'sectors_read', 'writes', 'sectors_written'] | |
result = {} | |
for line in (l for l in open(file_path, 'r').xreadlines() if l != ''): | |
parts = line.split() |
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
/*! | |
* quantize.js Copyright 2008 Nick Rabinowitz. | |
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php | |
*/ | |
// fill out a couple protovis dependencies | |
/*! | |
* Block below copied from Protovis: http://mbostock.github.com/protovis/ | |
* Copyright 2010 Stanford Visualization Group | |
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php |
OlderNewer