Skip to content

Instantly share code, notes, and snippets.

View martymcguire's full-sized avatar

Marty McGuire martymcguire

View GitHub Profile
Foo foo bar bar don't let martha drive your car.
Derp derp derp derp derp.
@martymcguire
martymcguire / add_camera_events.pl
Created July 25, 2010 19:17
Adds M150/151 camera-trigger codes to a MakerBot G-code build file
#!/usr/bin/env perl
# Usage:
# $ cat my.gcode | ./add_camera_events.pl > my_camera.gcode
my $x_pose = "0.0";
my $y_pose = "-45.0";
my $move_speed = "3300.0";
my $last_g1 = undef;
my $last_was_m103 = 0;
my $delay = 2000; # 2 seconds total wait time
@martymcguire
martymcguire / parametric_brick_2x2.scad
Created April 18, 2010 15:35
Create parametric LEGO-compatible bricks in OpenSCAD
// Quick-and-dirty parametric LEGO-compatible
// bricks in OpenSCAD.
// LEGO(R) is a trademark of the LEGO Group.
// References:
// * http://www.robertcailliau.eu/Lego/Dimensions/zMeasurements-en.xhtml
// * http://nicjasno.com/forum/viewtopic.php?t=653
// Create (w*2,h*2) LEGO-compatible blocks.
two_by_two(1,2);
@martymcguire
martymcguire / usbshot.bas
Created February 2, 2010 01:53
A script for handling USB Remote events on my Canon SD300 running CHDK
rem SETUP:
rem * Place in CHDK/SCRIPTS/ on your SD card
rem * Load the script in the Scripting Parameters
rem menu and turn Enable Remote on in Remote Parameters
rem
rem USAGE:
rem 1. Start the camera (and enable CHDK it doesn't autoload)
rem 2. Switch to record mode and disable the flash
rem 3. Switch to <ALT> mode and click Shoot to start the script
rem 4. The camera should shoot whenever USB power is detected.
@martymcguire
martymcguire / hackpgh_light_widget.html
Created November 19, 2009 17:36
Wordpress widget for displaying the status of the lights at HackPittsburgh
<div id="light_status"
style="width: 209px; height: 88px; margin-bottom: 10px; background: url('wp-content/themes/azul/images/shopClosed.png'); display:none;">&nbsp;</div>
<script>
function refreshLightStatus() {
$.getJSON("http://iobridge.com/api/feed/key=waStTNuoEvld6t9wsM&callback=?",
function(data){
if (data["module"]["status"] != "Online") {
$('#light_status').css('display','none');
} else {
@martymcguire
martymcguire / show_light_test.html
Created November 19, 2009 17:07
Simple example for reading an ambient light sensor via ioBridge
<html><head><title>Shop Light?</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
</head><body>
The ioBridge is: <div id="module_status">unknown</div>
The shop light is: <div id="light_status">unknown</div>
<script>
// Makes an asynchronous request to fetch our module data and updates
// the module status and light status with the received data.
function refreshLightStatus() {
#!/usr/bin/python
# face_detect.py
# Face Detection using OpenCV. Based on sample code from:
# http://python.pastebin.com/m76db1d6b
# Usage: python face_detect.py <image_file>
import sys, os