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
function si_prefix(size) { | |
var suffixes =['', 'k', 'M', 'G', 'T', 'P', 'E']; | |
if (size === 0) return '0'; | |
base = Math.log(size) / Math.log(1000); | |
return suffixes[Math.floor(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
#!/usr/bin/python | |
# -*- coding: utf8 -*- | |
import hashlib, random, timeit | |
def generate_it(bytes): | |
return ''.join(chr(random.getrandbits(8)) for x in xrange(bytes)) | |
def hash_it(stuff): | |
return hashlib.md5(stuff).hexdigest() |
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
# $Id: pcap.py 26 2006-11-21 01:18:55Z dahelder $ | |
"""Libpcap file format.""" | |
import sys, time | |
import dpkt | |
TCPDUMP_MAGIC = 0xa1b2c3d4L | |
PMUDPCT_MAGIC = 0xd4c3b2a1L |
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 | |
#jh- pasted from: | |
# http://peerit.blogspot.com/2007/07/multipartposthandler-doesnt-work-for.html | |
#### | |
# 02/2006 Will Holcomb <[email protected]> | |
# | |
# This library is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU Lesser General Public |
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
function setupValidation(field, timeout) { | |
var input = $('#id_'+field); | |
var input_tr = $('#id_tr_'+field); | |
check = function () { | |
var t = this; | |
if (this.value != this.lastValue) { | |
if (this.timer) clearTimeout(this.timer); | |
input_tr.removeClass('error'); | |
$('#id_tr_errors_'+field).remove(); | |
this.timer = setTimeout(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
""" | |
Classes for a dynamic, templated settings environment. | |
By "environment" we just mean a dictionary where keys can be accessed as | |
object attributes. The _AttributeDict class comes from Fabric. | |
The _RecursiveAttributeDict class takes this idea one step further, and lets | |
you refer to other keys in the dictionary using new-style python formatting | |
syntax (PEP 3101). See the class docstring for examples. | |
""" |
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 | |
"""usage: %prog [-n N] | |
Returns a random uniform sample of the lines on stdin using a technique | |
called reservoir sampling [VITTER '85]. Preserves input ordering.""" | |
import sys | |
from optparse import OptionParser | |
p = OptionParser(usage = __doc__) | |
p.add_option( |
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
^w hjkl move to windows | |
^w HJKL move windows | |
^w +- horizontal resize | |
^w = even splits | |
^w10<> vertical resize | |
O | |
I ia A |
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
<script language="javascript" type="text/javascript"> | |
SHARETHIS.addEntry({ | |
title:'Share me', | |
summary:'Sharing is good for the soul.', | |
icon: 'http://path.to/icon' | |
}, {button:true} ); | |
</script> |