Skip to content

Instantly share code, notes, and snippets.

@zvoase
zvoase / expandTinyURL.js
Created October 19, 2008 20:43
"untiny" Ubiquity Command
// Copyright (c) 2008 Zachary Voase
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
CmdUtils.CreateCommand({
name: "now",
_now: function(){
var date = new Date();
return date.toLocaleFormat("%A, %B %e %Y, %H:%M");
},
preview: function( pblock ) {
var msg = 'Inserts the current date and time: "<i>${timestamp}</i>"';
# Copyright (c) 2008 Zachary Voase
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
@zvoase
zvoase / fproc.py
Created October 27, 2008 22:22
Do interesting things with files.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# fproc: Do interesting things with files.
# Copyright (c) 2008 Zachary Voase
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
def number_to_string(number, words):
list_out = []
if not number:
return words[0] # Because 0 is '0', not ''.
while number:
list_out = [number % len(words)] + list_out
number = number // len(words)
return ''.join(words[n] for n in list_out)
def number_to_zpadded_string(number, length=32):
import copy
class Base(object):
def __init__(self, words, name=''):
self.__words = words
if not name:
name = 'base%d' % (self.length,)
self.name = name
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2008 Zachary Voase
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
@zvoase
zvoase / pylink.sh
Created November 2, 2008 04:12
pylink - Link and unlink Python modules to your site packages directory.
@zvoase
zvoase / pyunlink.sh
Created November 2, 2008 04:21
pyunlink.sh - remove a pylinked file from your site-packages directory.
import random
import re
import unicodedata
def slugify(string, randlen=10):
string_out = ''
for char in string:
if char.isspace():
string_out += '-'