Skip to content

Instantly share code, notes, and snippets.

@acspike
acspike / arrows.html
Created June 10, 2011 22:25
team photo slideshow kiosk mockup
<html>
<head>
<style type="text/css">
div#container {
top: 100px;
margin: auto;
position:relative;
width: 800px;
height: 650px;
text-align: center;
@acspike
acspike / ArrowKeys.pde
Created June 12, 2011 22:30
firmware for an arduino based usb arrow keypad
#include "UsbKeyboard.h"
#define BUTTON_PIN_RIGHT 9
#define BUTTON_PIN_LEFT 10
#define BUTTON_PIN_UP 11
#define BUTTON_PIN_DOWN 12
#define KEY_ARROW_RIGHT 0x4F
#define KEY_ARROW_LEFT 0x50
#define KEY_ARROW_UP 0x51
@acspike
acspike / lathem.py
Created December 15, 2010 20:05
Time Sync Protocol for Lathem Clocks
'''
DATA: 0#112233456677Z,CR (16 chars)
'0' is address byte
'#' is command code for Routine Time Update
where '11' is hex MS,LS of Seconds of Minute (1-59)
where '22' is hex MS,LS of Minutes of Hr (0-59)
where '33' is hex MS,LS of Hour of Day (0-23)
where '4' is hex Day of Week (Sun - 0 etc.)
where '5' is hex Month of Year (1-12)
where '66' is hex MS,LS of Day of Month (1-31)
@acspike
acspike / lpwords.py
Created November 21, 2012 14:20
cheating at letterpress
class word(object):
def __init__(self,w):
self.w = w
self.key = "%02d%s" % (len(w),w)
self.set = self._makeset(w)
def __str__(self):
return self.w
def __cmp__(self,other):
return cmp(other.key,self.key)
def __repr__(self):
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
var drawOn = function (id) {
var lastPoint = null;
var canvas = document.getElementById(id);
var ctx = canvas.getContext('2d');
ctx.lineWidth = 4;
var offset = jQuery('#'+id).offset();
@acspike
acspike / stills.py
Created December 18, 2012 04:49
Simple hands-free (with arduino-powered, foot-actuated, usb spacebar) workflow for stop motion animators.
from VideoCapture import Device
import pygame
import datetime
import glob
cam = Device()
pic_dir = './'
pic_ext = '.jpg'
pics = glob.glob(pic_dir+'*'+pic_ext)
@acspike
acspike / SpaceBar.pde
Created December 18, 2012 23:40
An arduino sketch for a foot actuated usb spacebar
// Much code borrowed from the following
// https://github.com/practicalarduino/VirtualUsbKeyboard
// http://playground.arduino.cc/Learning/SoftwareDebounce
#include "UsbKeyboard.h"
#define BUTTON_PIN 12
#define LED_PIN 13
#define KEY_SPACE 0x2C
from __future__ import print_function
import random, itertools, sets
## The following represents thought process and has not been subjected to rigorus proof
# Possible pairings can be represented as two varieties of cycles in the permutations of the residents due to the restriction on reflexive pairings.
# For each permutation there is a single cycle through all 7 name and a two disjoint cycles through 3 names and 4 names respectively.
# Total unique pairings are therefore less than 7!*2 = 10080 (less because cycles of a particular permutation generate equivalent pairings)
# There are 7! permutations. Cycles through all 7 that produce equivalent pairings can be elminiated by considering only permutations that begin with a particular digit (eg. 6).
# Therefore unique pairings for cycles through all 7 generates 6! = 720 (ie 7!/7) pairings.
# Considering 3,4 cycles inside of each permutation there should be (7!/(4!*3))(4!/4) = 420
from __future__ import print_function
import random, itertools, sets
## The following represents thought process and has not been subjected to rigorus proof
# Possible pairings can be represented as two varieties of cycles in the permutations of the residents due to the restriction on reflexive pairings.
# For each permutation there is a single cycle through all 7 name and a two disjoint cycles through 3 names and 4 names respectively.
# Total unique pairings are therefore less than 7!*2 = 10080 (less because cycles of a particular permutation generate equivalent pairings)
# There are 7! permutations. Cycles through all 7 that produce equivalent pairings can be elminiated by considering only permutations that begin with a particular digit (eg. 6).
# Therefore unique pairings for cycles through all 7 generates 6! = 720 (ie 7!/7) pairings.
# Considering 3,4 cycles inside of each permutation there should be (7!/(4!*3))(4!/4) = 420
from __future__ import print_function
import random, itertools, sets
## The following represents thought process and has not been subjected to rigorus proof
# Possible pairings can be represented as two varieties of cycles in the permutations of the residents due to the restriction on reflexive pairings.
# For each permutation there is a single cycle through all 7 name and a two disjoint cycles through 3 names and 4 names respectively.
# Total unique pairings are therefore less than 7!*2 = 10080 (less because cycles of a particular permutation generate equivalent pairings)
# There are 7! permutations. Cycles through all 7 that produce equivalent pairings can be elminiated by considering only permutations that begin with a particular digit (eg. 6).
# Therefore unique pairings for cycles through all 7 generates 6! = 720 (ie 7!/7) pairings.
# Considering 3,4 cycles inside of each permutation there should be (7!/(4!*3))(4!/4) = 420