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
nzjrs / test_crc.py
Created Oct 28, 2014
Non-table based implementations of crc16 and crc8-maxim
View test_crc.py
import crcmod.predefined
def _crc16(crc, c):
crc ^= ord(c)
for i in range(8):
if crc & 0x1:
crc = (crc >> 1) ^ 0xA001
else:
crc = (crc >> 1)
return crc
@nzjrs
nzjrs / gtk-theme-swatch.py
Created Jan 21, 2009
PyGtk widget that displays color swatches according you your Gtk theme
View gtk-theme-swatch.py
#!/usr/bin/env python
# gtk-theme-swatch: A PyGtk widget that displays the color swatches of all
# gtk.Styles, in all states. Useful for designing themes
# author: John Stowers <john.stowers@gmail.com>
import gtk
class ThemeSwatch(gtk.DrawingArea):
SWATCH_SIZE = 50 #swatch size
@nzjrs
nzjrs / emit.py
Created Feb 2, 2009
Python example demonstrating when callbacks are run in a threaded environment
View emit.py
#!/usr/bin/env python
# Python example demonstrating when callbacks are run in a threaded environment
# John Stowers
import threading
import thread
import time
import gobject
import gtk
@nzjrs
nzjrs / gtk-curve-test.py
Created Jun 30, 2009
Demo for testing gtk.Curve
View gtk-curve-test.py
#!/usr/bin/env python
# Demo for testing gtk.Curve
# John Stowers 2009
import random
import gtk
class UI:
TYPES = (gtk.CURVE_TYPE_LINEAR, gtk.CURVE_TYPE_SPLINE, gtk.CURVE_TYPE_FREE)
@nzjrs
nzjrs / test-rtgraph.py
Created Jul 12, 2009
python rtgraph demo
View test-rtgraph.py
#!/usr/bin/env python
# A simple example of using multiple rtgraph HScrollLineGraph widgets
# Micah Dowty <micah@picogui.org>, John Stowers
#
import gtk
import time, math, re
import gs.ui.rtgraph as rtgraph
windows = []
@nzjrs
nzjrs / curses-demo.py
Created Aug 8, 2009
Helper for using curses from python
View curses-demo.py
#!/usr/bin/env python
# This module provides a 'with' for using curses in Python.
# from: http://www.finalcog.com/python-with-curses-with_curses
from __future__ import with_statement
import curses
class WithCurses(object):
"""
@nzjrs
nzjrs / mirror.py
Created Jan 19, 2010
PyGtk client side windows demo
View mirror.py
#!/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 / Makefile
Last active Sep 5, 2015
LaTeX Makefile
View 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 / build-pygtk-windows-installers.sh
Created Oct 16, 2010
Script for building the Py{GObject,GTK} installers using MinGW
View build-pygtk-windows-installers.sh
#!/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 / oo-eps.bas
Created Nov 1, 2010
Exporting openoffice charts for LaTeX
View oo-eps.bas
' 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" )
You can’t perform that action at this time.