Skip to content

Instantly share code, notes, and snippets.

View martymcguire's full-sized avatar

Marty McGuire martymcguire

View GitHub Profile
#!/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
@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() {
@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 / 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 / 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 / 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
Foo foo bar bar don't let martha drive your car.
Derp derp derp derp derp.
@martymcguire
martymcguire / sticky_notes.py
Created January 9, 2011 20:12
Generate Post-It banners for plotting with your MakerBot Unicorn
#! /usr/bin/env python
# Usage: python sticky_notes.py 'Your Message Here!' > out.gcode
import cairo
import sys
import re
### BEGIN CONFIGURATION ###
feedrate = 3500
#!/usr/bin/perl -i
use strict;
use warnings;
# Slic3r 0.9.8 Post Processing Script to make it work with MakerWare 2.0 and Firmware 7 (only tested on a Rep1)
# Dualstrusion works
# Support on secondary extruder works
# Save this file somewhere, then under Print Settings, Output Options, Post-processing scripts, enter path to this file
# Under Printer Settings, General, set G-code flavor to MakerBot, extruders 2, bedsize 225 x 145, etc...
# generated by Slic3r 1.1.7 on Mon Sep 8 12:38:43 2014
avoid_crossing_perimeters = 1
bed_size = 200,200
bed_temperature = 60
bottom_solid_layers = 3
bridge_acceleration = 0
bridge_fan_speed = 100
bridge_flow_ratio = 1
bridge_speed = 60
brim_width = 0