An Access Logger for Netty and HTTP

We needed to do CLF style HTTP access logging for Thumbslug, which is implemented in Java + Netty. I couldn’t find any code to do this with a quick google search, so I wrote my own. If you need such a thing, try here or here (backup). »

Measuring Network Speeds with Netcat and Dd

I’ve seen a few posts on the web about testing your network speeds with netcat, but they all seem to not work with recent versions of netcat. On one machine, run: nc -v -l 2222 > /dev/null (Make sure you’re not blocking connections to 2222!) On a second machine, run: dd if=/dev/zero bs=1024K count=512 | nc -v $IP_OF_FIRST_MACHINE 2222 dd will give you your speed: 536870912 bytes (537 MB) copied, 4.87526 s, 117 MB/s Yay, gigabit! »

Converting SVN Commits to Git Patches

In case you find yourself in need of a way to turn an svn revision into a git patch that can be applied with ‘git am’, keeping the commit message and authorship information, here’s a script I used recently: #!/usr/bin/python # # svnrev2git.py - Convert an SVN revsion to a Git patch. # # Author: James Bowes <jbowes@repl.ca> # # Usage: # $> cd my-svn-repo # $> python svnrev2git.py [AUTHORS_FILE] [REV_RANGE | REVSION [REVISION..]] # # AUTHORS_FILE - a CSV of svn username, full name, email # REV_RANGE - an svn revision range, like 100-700 # REVISION - a single svn revision # # You may specify either a revision range, or a series of individual # svn revisions # # Output: # A series of git style patch files, one per svn revision, which can then be # applied with 'git am' # # Why use this instead of 'git svn'? »

DIY Velcro Cable Ties

Making your own velcro cable ties is a great idea. $2 in materials made as many cable ties as Wal- Mart was selling for $13. Thrifty! I’d suggest sewing the velcro together vs stapling, especially if you have cats that are far too curious about staples. »

Perceptions of Toronto

Growing up on the east coast of Canada, this is how I imagined Toronto to be, like, 24⁄7. I’ve been here for nine months or so, and have yet to be invited to any trendy VICE parties. Just so you know, VICE, I am very willing to grow out some stubble and wear vintage clothing or an ironic t-shirt for the event. Toronto is great though, even without the free Red Stripe. »

Graphing Git Repository Activity In ASCII

Here’s a quick little script I wrote up (adapted from this perlmonks post) to show git repository activity as an ascii graph, like so: The X axis represents a day, with the current day being on the far right. The Y axis is no. of lines added + no. of lines deleted during that day. EDIT (2009/02/03): Wordpress.com won’t let me attach a .pl file, so here’s the contents: #!/usr/bin/perl # # git-graph.pl - Generate an ascii graph of git repository activity # # Copyright (C) 2008 James Bowes <jbowes@dangerouslyinc.com> # # Graphing routine Adapted from http://www.perlmonks.org/?node_id=336907 sub get_activity { my $day = shift; my $git_cmd = 'git diff --shortstat "@{' . »

Installing ruby gems in your home directory

I found it hard to find good instructions for installing ruby gems as a non- root user without installing the gem package locally as well. Here’s what I figured out; hopefully this will save someone else some time in the future: Make a directory for gem installation: $> mkdir ~/.gems Set up your .gemrc for gem install-time configuration: $> cat << EOF > ~/.gemrc gemhome: $HOME/gems gempath: - $HOME/gems - /usr/lib/ruby/gems/1.8 EOF Set up some environment variables for run-time: $> cat << EOF >> ~/.bashrc export GEM_HOME=$HOME/gems export GEM_PATH=$HOME/gems:/usr/lib/ruby/gems/1.8/ export PATH=$PATH:$HOME/gems/bin EOF Source your bashrc and you’re all set. »

Shell HIstory Meme

[jbowes@laptop ~]$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head 211 git 148 fg 107 ls 99 cd 89 python 43 make 26 vim 23 sudo 20 nosetests 19 player/swfplay [jbowes@workstation ~]$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head -n 12 163 ls 156 cd 115 svn 76 vim 70 screen 55 fg 47 exit 35 sudo 30 git 21 yasql Seen on Adrian’s and Mike’s blogs. »

Cat News

Our boy cat Julius passed away a few weeks ago. It was pretty shocking, as he was quite young and his passing was sudden and unexpected. While we miss him terribly, Cherie and I didn’t want Spook to get too used to being an only cat again. So this weekend we picked up a new little fellow from the Toronto Humane Society: He doesn’t have a name yet, but he sure has quite a pair of ears on him! »