Skip to content

Instantly share code, notes, and snippets.

View bulletmark's full-sized avatar

Mark Blakeney bulletmark

  • Brisbane Australia
View GitHub Profile
@bulletmark
bulletmark / gist:5e9843fec479b74b293c
Created October 30, 2014 23:13
Simple piface program to toggle outputs and keep state over restart
#!/usr/bin/env python
import os, time, pickle, pifaceio
filename = os.path.join(os.path.expanduser('~'), '.' +
os.path.basename(__file__) + '.init')
pf = pifaceio.PiFace()
# Read stored last states
#!/usr/bin/env python
import time, threading
import pifaceio
# Width and number of output pulses in sequence
PULSE_ON = 2 # secs
PULSE_OFF = 1 # secs
PULSE_NUM = 3 # count of ON pulses in sequence
PIN_TRANSITIONS = PULSE_NUM * 2
#!/usr/bin/env python
import time, threading
import pifaceio
# Pressing a Piface board input pin starts a sequence of output pins + delays.
# Define output sequences here. Format is:
# in_pin: ((out_pin1, on_time), (out_pin2, on_time), [ .. ])
# if out_pin = -1 then delay for on_time only.
# It's up to you to define/use output sequences that don't conflict.
@bulletmark
bulletmark / hotot-gtk3
Last active December 26, 2015 20:29
Hotot startup wrapper.
#!/bin/bash
#
# Simple bash wrapper to ensure hotot app only runs once. Name this
# script "hotot", "hotot-gtk3", or "hotot-qt5", etc as appropriate for you and
# put early in your PATH, e.g. in your $HOME/bin/.
#
# Author: Mark Blakeney.
prog=$(basename $0)
real=/usr/bin/$prog
@bulletmark
bulletmark / ftpd-topfield patch
Created March 28, 2011 22:12
Makes ftpd-topfield clean up closed socket correctly, even when lost ungracefully from vlc >v0.9.
diff --git a/ftpd-topfield/ftpd.c b/ftpd-topfield/ftpd.c
index db0b67b..f6d3458 100644
--- a/ftpd-topfield/ftpd.c
+++ b/ftpd-topfield/ftpd.c
@@ -932,6 +932,7 @@ reboot_topfield (void)
void
retrieve (const char *cmd, const char *name)
{
+ static int in_get;
FILE *dout = 0;