Showing posts with label tech. Show all posts
Showing posts with label tech. Show all posts

Sunday, August 4, 2013

Buckler v1.0.0


Buckler is Shields as a Service (ShaaS, or alternatively, Badges as a Service) for use in GitHub READMEs, or anywhere else. Use Buckler with your favorite continuous integration tool, performance monitoring service API, or ridiculous in-joke to surface information.

Buckler is MIT licensed. You are free to:
  • Host your own version of Buckler.
  • Download and re-serve generated shields.
  • Link directly to b.repl.ca for static information display (eg licensing details).
  • Redirect to b.repl.ca from another service for dynamic information (eg build status).

Check out the API on GitHub, view the README for more examples, or play around with the simple form on b.repl.ca.

Sunday, December 16, 2012

Squeezebox Server & Fedora


To get squeezeboxserver working on Fedora, add the following to /etc/sysconfig/iptables:

# squeezebox
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3483 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 3483 -j ACCEPT

Saturday, December 15, 2012

IRSSI Keys on a MacBook Pro

At $newjob I'm using a late 2011 MacBook Pro, so I've had to relearn some keys for IRSSI. The important ones to me are:


  • fn + up arrow / down arrow: for viewing the backscroll (page up / page down)
  • Setting an option key to "+esc" under iTerm2 so I can hold down the key and use left and right arrows to move through open windows.

Saturday, January 21, 2012

Micro USB for Power Everywhere

One of the reasons I'm very excited for  Rasberry Pi is that it uses micro USB for power. This is also the standard may cell phone manufacturers are settling on for charging. I would love to see more every day devices use micro USB for charging and for power. Granted, not all devices can run off the 100mA from USB 2.0 (or charge at a reasonable rate), but I can eliminate just one more of those odd coaxial chargers, I'd be a happy fellow.

Tuesday, December 6, 2011

Essential Gnome Shell Extensions For Laggards

My ideal workstation
Image by ClickPick, used under the 
Gnome 3 introduced a lot of fundamental changes to how you interact with your computer. I don't want to hopelessly cling to the past, bemoaning the loss of my Lisp based window manager and yearning for the days when I could debate the merits of pure applets vs notification area icons, so I've moved on to gnome-shell.

That said, I've been using a few tweaks to bring Gnome 3 and gnome-shell closer to what I'm used to. Consider them training wheels; they can be disabled over time, easing the transition.

Saturday, December 3, 2011

Android ProGuard and Git Tip

If you're obfuscating your Android applications using ProGuard, make sure to keep the proguard/ directory at the root of your Android project under revision control. This may seem contrary to what you'd feel like doing, as the files are autogenerated, but it will help if you ever need to debug a stack trace from your published application.

Friday, December 2, 2011

My .gitconfig - 2011 Edition

It's been just shy of five years since I first blogged about my .gitconfig file, so I figured now would be a good time to revisit it. If you're not already aware, you can set git configuration values in a .gitconfig file in your home directory, and have them apply to all git repositories you work on. This is particularly useful for aliases and to set your email address.

My current .gitconfig:

Wednesday, November 30, 2011

BTRFS and KVM

If you're like me, you've spend the last year wondering why your KVM based virtualization is horribly slow when doing IO. You've tried twiddling every available option in your BIOS, you've mucked about with hdparm  and libvirt/qemu settings, and you've run more timed installs of RHEL 5 than you care to admit.

If you're also like me, you tried using ext4 instead of BTRFS to store your guest images today, and found that this resolved your issue.

The relevant bz appears to be here.

The lesson I learned today is to blame experimental or newer features before anything else (though its doubtful I'll remember this next time).

Monday, November 28, 2011

Importing VPN Settings in GNOME 3

I've noticed after upgrading my workstation to Fedora 16 that GNOME 3's default NetworkManager UI doesn't expose the old UI's import option for VPN settings. I have my old OpenVPN settings file on hand, so I'd rather not type it out again.

Turns out you can still access the old UI and its convenient import button by running nm-connection-editor.

Friday, November 25, 2011

CPSN v0.8.0

This is just a quick update to CPSN, fixing detection of stale cookies. It will also prompt you for a username and password if you forget to put one in the settings file (or don't want to save your password on disk).

Install it with gem install --user cpsn
Check the included README for details on configuration.

Git: https://github.com/jbowes/cpsn

Note: Using CPSN probably violates any number of Terms of Service, etc. Use at your own risk.

Thursday, November 24, 2011

A PEM Backed Keystore for Java SSL

For Thumbslug, we needed to open a number of SSL connections to the same server, each with its own X.509 client certificate. Thumbslug grabs the certificates from Candlepin, which stores them in PEM format. Rather than teach Candlepin to also store these certificates in a different format, or to load them first into a format that Java deals with nativley (like PKCS #12), I figured it would be best to create an SSLSession backed directly by an X509Certificate and PrivateKey loaded from the PEM file.

I wasn't able to find any other examples of a PEM backed Java KeyStore, so here is mine (backup), and the code that uses it (backup). Since PEM is still widely used (by OpenSSL, for example), hopefully others can make use of this.

Monday, November 21, 2011

HOWTO Make a USB Y Cable for Host Mode


Many smartphones or tablets support USB host mode (or On The Go mode) with an adapter. Unfortunately, a lot of those devices don't supply power to their client USB devices; you can't just plug a host mode adapter into an HP TouchPad, for example, then plug a keyboard into the host mode adapter, and expect everything to work.

I put up a video on youtube explaining how to build and use a USB Y cable to inject power to the client devices. If you'd like, you can watch it here

Tuesday, July 5, 2011

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).

Wednesday, October 13, 2010

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!


ymmv, test with /dev/zero at your own risk. Speak with your NOC before starting any network infrastructure changes.

Tuesday, June 23, 2009

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'?
#   I had done a large repo conversion via git svn where we wanted no downtime
#   for the switchover. After removing the git svn specific info from our git
#   commits, I used this tool to bring in commits from svn, keeping svn and git
#   in sync, until we were ready to switch.

import sys
import commands

def svnlog_to_gitlog(authors, svnlog):

lines = svnlog.split("\n")
lines = lines[1:-1]

metainfo = lines[0].split(" | ")
subject = lines[2]
description = lines[3:]

author = metainfo[1]

day = metainfo[2].split("(")[1][:-1]
time = metainfo[2].split(" ")[1]
offset = metainfo[2].split(" ")[2]

gitlog = []
gitlog += ["From: %s <%s>" % authors[author]]
gitlog += ["Date: %s %s %s" % (day, time, offset)]
gitlog += ["Subject: [PATCH] %s" % subject]
gitlog += [""]
gitlog += description
gitlog += [""]

return '\n'.join(gitlog)

def svndiff_to_gitdiff(svndiff):
lines = svndiff.split("\n")

gitdiff = []
for line in lines:
if line.startswith("--- "):
gitdiff.append("--- a/" + line[4:])
elif line.startswith("+++ "):
gitdiff.append("+++ b/" + line[4:])
else:
gitdiff.append(line)

return '\n'.join(gitdiff)

def make_patch(authors, rev):
out = commands.getoutput("svn log -c %s ." % rev)

if len(out.split("\n")) < 2:
print "skipping r%s" % rev
return

patch = open(rev + ".patch", 'w')
patch.write(svnlog_to_gitlog(authors, out))
patch.write("---\n\n")

out = commands.getoutput("svn diff -c %s ." % rev)
patch.write(svndiff_to_gitdiff(out))

patch.write("\n---\n")
patch.write("svnrev2git.py\n")

patch.close()
print "wrote %s.patch" % rev

def main(args):
author_file = open(args[0])
authors = {}

print "loading authors"
for line in author_file.readlines():
parts = line.strip().split(", ")
authors[parts[0]] = (parts[1], parts[2])

author_file.close()

revs = args[1:]

if len(revs) == 1 and '-' in revs[0]:
start, end = revs[0].split('-')
start = int(start)
end = int(end)
revs = [str(x) for x in range(start, end + 1)]

for rev in revs:
make_patch(authors, rev)

if __name__ == "__main__":
main(sys.argv[1:])

Monday, October 20, 2008

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.

Wednesday, April 9, 2008

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.

Tuesday, January 29, 2008

2% Genius

Agile Tsar Dmitri Dolguikh pointed out Project Euler yesterday, which is a website containing a series of short programming problems. It reads a bit like bonus questions on a math exam, which is actually quite refreshing compared to the day-to-day problems at work. For added fun, I'm trying to run through the problems in Common Lisp.

So far I have completed 4 out of 179 problems, which makes me 2% genius, according to the site.

Tuesday, January 8, 2008

Mission Accomplished!

A lot of people are linking to this article about the state of the practice in CS curriculum and its use of Java creating dull replaceable drones.

mdehaan points out a wonderful section wherein the authors relate Java programming to a plumber in a hardware store, finding pieces and putting them together to solve a problem, rather than their unmentioned alternative (maybe an artist molding clay?)

If this is true, then we, the software industry and software engineering fields, are done. We have found the holy grail: true modularity and reusable software components. Drop whatever language you're using and switch to Java.
© 2012 James Bowes. Icons by glyphicons. Powered by Blogger.