Skip to content

Instantly share code, notes, and snippets.

View nzjrs's full-sized avatar

John nzjrs

View GitHub Profile
@nzjrs
nzjrs / gen-git-stats.sh
Created April 3, 2011 01:39
Generate development history statistics for PyGTK
#!/bin/sh
OUT="./"
PROJ="/home/john/Programming/pygtk.git/"
pepper activity --datemin=1998-12-01 --output=${OUT}/activity.png --size=800x600 ${PROJ}
pepper activity --split=authors --n=10 --datemin=1998-12-01 --output=${OUT}/activity-auth.png --size=800x600 ${PROJ}
pepper activity --split=directories --datemin=1998-12-01 --output=${OUT}/activity-directories.png --size=800x600 ${PROJ}
pepper loc --output=${OUT}/loc.png --size=800x600 ${PROJ}
pepper loc --tags --output=${OUT}/loc-tags.png --size=3200x600 ${PROJ}
@nzjrs
nzjrs / gdk-gstappsrc-stream.c
Created December 2, 2010 10:47
GStreamer Streaming AppSrc Example
/* 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
nzjrs / gtkview.c
Created November 18, 2010 12:03
GTK+ Viewer for Microsoft Kinect (uses libfreeconect)
/*
* Gtk example to show depth map from Micrsoft Kinect
* Copyright (c) 2010 John Stowers
*
* Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
* for details.
*
* This code is licensed to you under the terms of the Apache License, version
* 2.0, or, at your option, the terms of the GNU General Public License,
* version 2.0. See the APACHE20 and GPL2 files for the text of the licenses,
@nzjrs
nzjrs / oo-eps.bas
Created November 1, 2010 11:24
Exporting openoffice charts for LaTeX
' Export all charts from a Calc spreadsheet to EPS
' (c) Jose Fonseca
' Taken from http://www.oooforum.org/forum/viewtopic.phtml?t=60155
Sub Main
Dim oDoc, oDocCtrl, oDocFrame, oDispatchHelper
oDoc = ThisComponent
oDocCtrl = oDoc.getCurrentController()
oDocFrame = oDocCtrl.getFrame()
oDispatchHelper = createUnoService( "com.sun.star.frame.DispatchHelper" )
@nzjrs
nzjrs / build-pygtk-windows-installers.sh
Created October 16, 2010 06:27
Script for building the Py{GObject,GTK} installers using MinGW
#!/bin/sh
# Script for building the Py{GObject,GTK} installers using MinGW
# via wine on ubuntu 10.04
#Install the deps, MinGW and MSYS. GCC 4.5.0
#wine mingw-get.exe install gcc
#wine mingw-get.exe install msys-base
PYVERSIONS="6 7"
BDIST_TARGETS="wininst msi"
@nzjrs
nzjrs / Makefile
Last active May 20, 2020 21:12
LaTeX Makefile
# Makefile for LaTeX files
# Original file from http://www.acoustics.hut.fi/u/mairas/UltimateLatexMakefile
# please check http://www.takeonthecity.nl/roels-latex-makefile/ (Roel)
# current version http://gist.github.com/503886 (John)
# Copyright (c) 2009,2010 (in order of appearance):
# Roel Meeuws <r.j.meeuws@gmail.com>
# John Stowers <john.stowers@gmail.com>
# ChangeLog:
@nzjrs
nzjrs / lcd_chars.txt
Created May 28, 2010 12:26
PyGtk LCD Widget
# Character set for the Squeezebox display
00
00000
00000
00000
00000
00000
00000
00000
@nzjrs
nzjrs / mirror.py
Created January 19, 2010 00:08
PyGtk client side windows demo
#!/usr/bin/env python
# Gtk+ client-side-windows demo in python
# John Stowers
import gobject
import cairo
import gtk
import gtk.gdk as gdk
#hacks for using functions not exposed in this pygtk version
@nzjrs
nzjrs / fix-update-copyright-headers.py
Created October 13, 2009 11:36
Update or add copyright headers to source files.
@nzjrs
nzjrs / datedifference.py
Created October 11, 2009 11:38
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: http://www.chimeric.de/blog/2008/0711_smart_dates_in_python
def humanize_date_difference(now, otherdate=None, offset=None):
if otherdate:
dt = otherdate - now
offset = dt.seconds + (dt.days * 60*60*24)