View classy.js
// Requires ES5
// Inheritance pattern inspired by http://stackoverflow.com/a/5546053
// instanceOf has the usual straightforward-inheritance-checker problems with iFrames
if (typeof classyJS === 'undefined') {
var classyJS = (function () {
'use strict';
View ln2.py
from math import ceil
# for example, inc=4 gives ln16, or the number of hexadecimal digits
# required to represent n.
def ln2(n, inc=1):
if n<0:
raise ValueError('math domain error')
i = 0
n = int(ceil(n))
View prettybin.py
_fmtinner = ('',' ') * 3 + ('','-') + ('',' ') * 3 + ('','')
_fmtouter = (' ', ' |', '|')
def _mkhex(d, i):
try:
return '%02x' % (ord(d[i]),)
except IndexError:
return ' '
def _mkchar(d, i):
View hexdump.format
"%04_ax "
2/1 "%02x" " " 2/1 "%02x" " " 2/1 "%02x" " " 2/1 "%02x" "-" 2/1 "%02x" " " 2/1 "%02x" " " 2/1 "%02x" " " 2/1 "%02x"
" |"
16/ "%_p"
"|\n"
View mydirs.py
# The definitions are in the file "mydirs.dat" which is in the same directory
# as this file. Lines of this file may be blank or a label/directory pair,
# colon delimited. These can contain just about anything that doesn't confuse
# the shell, except colons and newlines, of course.
# Into your .bashrc, .profile, .zshrc, or whatever:
# cd_()
# {
# cd `python /home/memyselfi/python/mydirs.py $@`