Thursday, February 21, 2008

SOCKS proxy using SSH

I've just seen and used a brilliant ssh option.

The command:
sudo ssh -D localport user@externalhost
will set up a local SOCKS proxy listening on localport which will route all your traffic (including privledged ports) via external host.

Sunday, February 17, 2008

Notebook Audio

My notebook audio (Intel HDA) is terrible. Using jackd, I constantly get xruns, and I cannot change any parameters to try and alleviate the problem.

So, I bought an external USB audio device, plugged it in, and it just worked. No more xruns. Jackd no longer complains, and I have 5ms latency. Amazing. Even a cheap ($5) USB device performed better than the internal audio device in my laptop. It's an XPS M1330 by the way.

To celebrate I bought a pair of Edirol MA-15 Monitor speakers, which are a pleasure to listen to. Now I can look forward to getting to grips with Pure Data, or maybe Galan, which looks quite interesting.

Friday, February 01, 2008

Pyglet + Joystick

I've written a pygletified Joystick class. I'm not sure I'm using dispatch_events correctly, but it seems to work. With some more work it could support OSX and Win32.
from pyglet import event
import sys

if sys.platform == 'linux2':
import struct
from select import select

class Joystick(event.EventDispatcher):
JS_EVENT_BUTTON = 0x01 #/* button pressed/released */
JS_EVENT_AXIS = 0x02 #/* joystick moved */
JS_EVENT_INIT = 0x80 #/* initial state of device */
JS_EVENT_SIZE = struct.calcsize(JS_EVENT)

def __init__(self, device_number):
device = '/dev/input/js%s' % device_number
event.EventDispatcher.__init__(self) = open('/dev/input/js0')

def dispatch_events(self):
r,w,e = select([],[],[], 0)
if not in r: return
evt =
time, value, type, number = struct.unpack(self.JS_EVENT, evt)
evt = type & ~self.JS_EVENT_INIT
if evt == self.JS_EVENT_AXIS:
self.dispatch_event('on_axis', number, value)
elif evt == self.JS_EVENT_BUTTON:
self.dispatch_event('on_button', number, value==1)

def on_axis(self, axis, value):

def on_button(self, button, pressed):


raise ImportError('Platform not supported (%s)' % sys.platform)

if __name__ == "__main__":
j = Joystick(0)
def on_button(button, pressed):
print 'button', button, pressed

def on_axis(axis, value):
print 'axis', axis, value

while True:

Popular Posts