Skip to content

Instantly share code, notes, and snippets.

View jbowes's full-sized avatar
🍀
🌙⭐️🌈❤️🧲🎈🦄

James Bowes jbowes

🍀
🌙⭐️🌈❤️🧲🎈🦄
View GitHub Profile
@jbowes
jbowes / gist:58089
Created February 4, 2009 13:07
A squid in CFDG
startshape squid
rule tentacle {
CIRCLE { s .5 1.2 hue 90 sat 1 b .9}
CIRCLE { s .6 1.2 b -1 z -1}
tentacle { s .9 y .3 r 3}
}
rule tentacle {
tentacle { flip 90}
" buildr (http://buildr.apache.org) filetype detection for vim
" drop this file into ~/.vim/ftdetect/
au BufRead,BufNewFile buildfile set filetype=ruby
au BufRead,BufNewFile Buildfile set filetype=ruby
#!/usr/bin/python
#
# jsondent - json indenter
#
# (C) 2010 James Bowes <jbowes@repl.ca>
#
# very complicated code!
import sys
import json
def append(self, path, certlist):
try:
cert = self.cls()
cert.read(path)
bogus = cert.bogus()
if bogus:
bogus.insert(0, _('Reason(s):'))
raise Exception('\n - '.join(bogus))
certlist.append(cert)
except Exception, e:
@jbowes
jbowes / randimage.py
Created April 26, 2011 14:31
grab a random image. hook it up to your irc client for good times!
#
# Here's my alias:
# trout = "me slaps $0 around a bit with a large trout";
# image = "exec -out python ~/randimage.py \"$-\"";
# "image-arg" = "exec -out python ~/randimage.py -showargs \"$-\"";
import sys
import urllib
import simplejson
import random
@jbowes
jbowes / HttpRequestLogger.java
Created July 5, 2011 16:44
CLF style access logger for Netty based HTTP servers
/**
* Copyright (c) 2011 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public License,
* version 2 (GPLv2). There is NO WARRANTY for this software, express or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
* along with this software; if not, see
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
/**
* Copyright (c) 2011 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public License,
* version 2 (GPLv2). There is NO WARRANTY for this software, express or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
* along with this software; if not, see
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
/**
* Copyright (c) 2011 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public License,
* version 2 (GPLv2). There is NO WARRANTY for this software, express or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
* along with this software; if not, see
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
N A C K !
  /\___/\
/ /    ヽ ::: \
| (●), 、(●)、 |
|  ,,ノ(、_, )ヽ、,,   |
|   ,;‐=‐ヽ   .:::::|
\  `ニニ´  .:::/
/`ー‐--‐‐―´´\
       .n:n    nn
#!/usr/bin/python
#
# Fixes your manifest. Oops!
import os
import glob
import shutil
import simplejson as json
import sys
import tempfile