Skip to content

Instantly share code, notes, and snippets.

View wrboyce's full-sized avatar

Will Boyce wrboyce

View GitHub Profile
@wrboyce
wrboyce / aql.py
Created March 23, 2009 00:39
Interface to the AQL (aql.co.uk/telecoms) Reseller APIs
""" Interface to the AQL (aql.co.uk/telecoms) Reseller APIs. """
import urllib
class ApiInterface(object):
""" Abstract AQL API """
url = ''
exports = ()
def call(self, action, **kwargs):
@wrboyce
wrboyce / fs.py
Created April 6, 2009 12:17
Very Simple wrapper for FreeSWITCH's mod_xml-rpc
import xmlrpclib
class FreeSwitchServer(xmlrpclib.Server):
""" Very Simple wrapper for FreeSWITCH's mod_xml-rpc """
def __init__(self, user, passwd, host, port=8080):
xmlrpclib.Server.__init__(self, 'http://%s:%s@%s:%s' % (user, passwd, host, port))
def __getattr__(self, cmd):
def _caller(*args):
print ' '.join(args)
(function($) {
$.fn.maxlength = function(options) {
var settings = $.extend({
maxWords: 60,
badClass: false, // apply this class to an invalid element
statusIdSuffix: '_wc', // hold the words remaining information (elementId_wc)
errorMsg: 'To many words have been entered in this field.',
}, options);
return this.each(function() {
@wrboyce
wrboyce / borg.py
Created July 23, 2009 11:45
Borg Design Pattern for a Shared State across Instances of a Class
class Borg(object):
""" Borg Design Pattern for a Shared State across Instances of a Class. """
__hivemind = {}
def __new__(cls, *args, **kwargs):
self = super(cls.__class__, cls).__new__(cls, *args, **kwargs)
self.__dict__ = cls.__hivemind[cls.__name__] = {}
return self
import math
def utm_to_latlon(zone, easting, northing, northern_hemisphere=True):
""" Convert UTM to Latitude/Longitude. """
a = 6378137
e = 0.081819191
e1sq = 0.006739497
k0 = 0.9996
use warnings;
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '1.0';
%IRSSI = (
authors => 'Will Boyce',
contact => '[email protected]',
name => '/brb',
<phoenixrises> tamonten: you is dad nao?
<tamonten> phoenixrises: not yet, but today
<Will|> tamonten 2.0 planned for release today?
<Will|> I hope everything goes well, no last minute bugs :)
<phoenixrises> Will|: child birth isn't like your code ;)
<tamonten> well the release date has already slipped, so I'm hoping there was some extra QA done during that time
<phoenixrises> tamonten: would hope so, after failing the penetration test 9months ago, you never know what could be going on
<tamonten> I think you'll find the penetration test was very successful :P
<phoenixrises> tamonten: considering in pen testing you /dont/ want to be able to get in, I think not :P
<tamonten> lets leave that analogy before someone mentions backdoors in the system shall we?
@wrboyce
wrboyce / gist:786460
Created January 19, 2011 17:12
pre-commit hook to automatically minify javascript/css
#!/usr/bin/zsh
COMPRESSOR=$(whence -p yui-compressor)
[ -z $COMPRESSOR ] && exit 0;
function _compress {
local fname=$1:t
local dest_path=$1:h
local min_fname="$dest_path/${fname:r}.min.${fname:e}"
$COMPRESSOR $1 > $min_fname
phobos:~% x=(1 2 3)
phobos:~% for i in $x; echo $i
1
2
3
phobos:~% for i in (1 2 3); echo $i
zsh: unknown file attribute
We couldn’t find that file to show.