Skip to content

Instantly share code, notes, and snippets.

John Stowers nzjrs

Block or report user

Report or block nzjrs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nzjrs / gdk-gstappsrc-stream.c
Created Dec 2, 2010
GStreamer Streaming AppSrc Example
View gdk-gstappsrc-stream.c
/* gcc gdk-gstappsrc-stream.c -Wall `pkg-config --cflags --libs gstreamer-app-0.10 gdk-pixbuf-2.0` -o gdkstream */
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
nzjrs /
Created Jan 30, 2014
Reconnect python logging calls with the ROS logging system
class ConnectPythonLoggingToROS(logging.Handler):
MAP = {
nzjrs /
Created Aug 8, 2009
Helper for using curses from python
#!/usr/bin/env python
# This module provides a 'with' for using curses in Python.
# from:
from __future__ import with_statement
import curses
class WithCurses(object):
nzjrs / Makefile
Created May 25, 2011
Python ctypes example
View Makefile
all: test testmodule libtest.c
$(CC) -Wall -g -fPIC -shared -o $@ $? -lc
test: test_main.c libtest.o
$(CC) -o $@ $?
testmodule: testmodule.c
python build
nzjrs /
Created Oct 11, 2009
Humanize date differences
#!/usr/bin/env python
# This function prints the difference between two python datetime objects
# in a more human readable form
# Adapted from:
def humanize_date_difference(now, otherdate=None, offset=None):
if otherdate:
dt = otherdate - now
offset = dt.seconds + (dt.days * 60*60*24)
nzjrs /
Created Jun 3, 2011
Python script to make Skype co-operate with GNOME3 notifications
#!/usr/bin/env python
# Python script to make Skype co-operate with GNOME3 notifications.
# Copyright (c) 2011, John Stowers
# Adapted from
# Copyright (c) 2009, Lightbreeze
nzjrs /
Created Oct 13, 2009
Update or add copyright headers to source files.
nzjrs /
Created Feb 11, 2014
Get and set the MTU for an interface
import re
import socket
import struct
import logging
import subprocess
from fcntl import ioctl
nzjrs /
Created Jan 25, 2009
PyGtk threading example
# Demo application showing how once can combine the python
# threading module with GObject signals to make a simple thread
# manager class which can be used to stop horrible blocking GUIs.
# (c) 2008, John Stowers <>
# This program serves as an example, and can be freely used, copied, derived
# and redistributed by anyone. No warranty is implied or given.
import gtk
import gobject
nzjrs / .gitmodules
Created Mar 29, 2012
University of Canterbury Thesis Template
View .gitmodules
[submodule "documents/latex-makefile"]
path = documents/latex-makefile
url = git://
You can’t perform that action at this time.