Skip to content

Instantly share code, notes, and snippets.

View pingswept's full-sized avatar

Brandon Stafford pingswept

  • Tufts University
  • Somerville, Massachusetts, USA
View GitHub Profile
@pingswept
pingswept / burn_sd_card.py
Created July 19, 2012 17:19
Python script for burning Rascal filesystem tarball to SD card
#!/usr/bin/env python
import subprocess, sys
device = '/dev/sdc1'
label = 'beriberi'
tarball = 'rascal-filesystem-beriberi-2012-11-09.tar.gz'
commands = [
'umount ' + device,
@pingswept
pingswept / burn-rascal.tcl
Created July 19, 2012 17:21
TCL script for burning Rascal serial flash
set at91bootstrap "resized-boot-at91sam9g20-ek-serialflash2sdram.bin"
set bin ".bin"
set ubootprefix "u-boot-rm00"
#set uboot "$ubootprefix[lindex $argv 0]$bin"
set tf 35; # stupid hack because argv only works from command line
set uboot "$ubootprefix$tf$bin"
set kernel "linux-2.6.36-rascal-2011-11-02.bin"
set sourcedir "C:/Users/brandon/Desktop/My Dropbox/Rascal/Software/useful-binaries/"
puts "### PATHS FOR NEXT BURN ###"
@pingswept
pingswept / index.html
Created July 21, 2012 17:21
Rascal sold-out notification
<p>The Rascal is currently <strong>sold out</strong>. A mildly revised PCB is in the works, and we'll have more Rascals in stock soon (perhaps around June 21, but these deadlines tend to slide).</p>
<p>If you might want to buy a Rascal in future, sign up for the announcement list (low traffic; you can unsubscribe).</p>
<!-- Begin MailChimp Signup Form -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript" src="http://downloads.mailchimp.com/js/jquery.validate.js"></script>
<script type="text/javascript" src="http://downloads.mailchimp.com/js/jquery.form.js"></script>
<script type="text/javascript">
// delete this script tag and use a "div.mce_inline_error{ XXX !important}" selector
// or fill this in and it will be inlined when errors are generated
var mc_custom_error_style = '';
@pingswept
pingswept / gist:3220679
Created July 31, 2012 21:21
Testing OpenCV on the Rascal
[root@rascal14:/var/www/public/static/images]: python
Python 2.6.6 (r266:84292, Jun 18 2012, 19:18:49)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
>>> im = cv.LoadImageM('rascal.png', 1)
>>> dst = cv.CreateImage(cv.GetSize(im), cv.IPL_DEPTH_16S, 3)
>>> laplace = cv.Laplace(im, dst)
>>> cv.SaveImage('rascal-laplace.png', dst)
@pingswept
pingswept / i2c-motor.c
Last active October 10, 2015 22:18
I2C motor control code for Rascal/Arduino
// Motor number 1 (Front) is 29 hex or 41 decimal
#include <Wire.h>
#include <AFMotor.h>
AF_DCMotor motor(4);
int x=0;
void setup()
@pingswept
pingswept / fastenal-convert.py
Created October 3, 2012 00:03
Conversion of badge IDs for Fastenal vending machine
#!/usr/bin/python
# fastenal_convert.py
# Copyright 2008 Brandon Stafford
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
@pingswept
pingswept / rascal-autossh.conf
Created October 15, 2012 23:04
Init script for the Rascal's autossh daemon
# command looks like:
# ssh -R *:8080:localhost:8080 root@rascalmicro.com -N &
#
[autossh_tunnel]
enabled = 1
ssh_keys = /home/root/.ssh/id_rsa
remote_host = rascalmicro.com
remote_username = root
port = 8000
@pingswept
pingswept / motor.py
Created October 18, 2012 19:13
scrap of motor code from server.py
# Mostly originally written by Richard Klancer.
# Licensed under MIT license: http://opensource.org/licenses/MIT
class Motor:
SERIAL_SPEED = 115200
TIMEOUT_INTERVAL = 3
def __init__(self):
import time
@pingswept
pingswept / lightblades-test.py
Created October 19, 2012 14:32
light blade code test
from flask import Flask, render_template, request
public = Flask(__name__)
@public.route('/sms', methods=['POST'])
def parse_sms():
import pytronics
sender = request.form['From']
message = request.form['Body']
print 'SMS received from %s: %s' % (sender, message)
@pingswept
pingswept / dmx.py
Created October 20, 2012 00:22
Python function for sending DMX via the Rascal
def sendDMX(data):
import serial
# Make a DMX packet out of the data
dmxPacket = chr(0x00) + ''.join(chr(element) for element in data)
# To create sync signal (break and mark after break, in DMX-speak),
# slow port down and send a long 0