Skip to content

Instantly share code, notes, and snippets.

View smarthall's full-sized avatar

Daniel Hall smarthall

View GitHub Profile
@smarthall
smarthall / gist:1618800
Created January 16, 2012 02:56
Hacked Tone Library example for LeoStick
// A fun sketch to demonstrate the use of the Tone library.
// To mix the output of the signals to output to a small speaker (i.e. 8 Ohms or higher),
// simply use 1K Ohm resistors from each output pin and tie them together at the speaker.
// Don't forget to connect the other side of the speaker to ground!
// You can get more RTTTL (RingTone Text Transfer Language) songs from
// http://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation
/*************************************************
@smarthall
smarthall / gist:1726243
Created February 2, 2012 22:38
ArcadeMachineControls
// Settings
#define PLAYER_NUM 1
#define PIN_SQUELCH 5
// Constants
#define USB_PKT_SIZE 8
#define USB_KEY_START 2
#if PLAYER_NUM == 1
#define PIN_COUNT 15
@smarthall
smarthall / strnchr.c
Created February 28, 2012 22:04 — forked from jehiah/strnchr.c
strnchr because it doesn't exist for some reason
#include <stdlib.h>
/*
Returns a pointer to the first occurrence of character in the C string str.
The terminating null-character is considered part of the C string. Therefore,
it can also be located to retrieve a pointer to the end of a string.
@param str the string to be searched
@param len the number of characters to search
@param character the character to search for
@smarthall
smarthall / update-dns.sh
Created May 8, 2012 00:24 — forked from jfro/update-dns.sh
Linode dynamic DNS updating script
#!/bin/sh
# modified by jfro from http://www.cnysupport.com/index.php/linode-dynamic-dns-ddns-update-script
# Uses curl to be compatible with machines that don't have wget by default
LINODE_API_KEY=licensekey
DOMAIN_ID=domainid
RESOURCE_ID=resourceid
WAN_IP=`curl -s http://example.com/whatsmyip.php`
if [ -f $HOME/.wan_ip.txt ]; then
@smarthall
smarthall / gist:2716231
Created May 17, 2012 04:06
PhotoMapDisplay
//We always have to include the library
#include "LedControl.h"
LedControl lc=LedControl(10,11,12,1);
unsigned long delaytime=100;
void setup() {
Serial.begin(9600);
@smarthall
smarthall / gist:4095271
Created November 17, 2012 11:58
Fridge Data logger
// This file has moved into the glassfridge project.
// Find it here: https://github.com/smarthall/glassfridge
#include <SoftwareSerial.h>
// software serial #1: TX = digital pin 2, RX = digital pin 3
SoftwareSerial xbee(2, 3);
unsigned long nextreport;
#define REPORTINT 10000UL
@smarthall
smarthall / display.sh
Last active December 18, 2015 22:59
Beaglebone to OpenSegment code for REA Hack Day 2013
#!/bin/bash
# To use:
# Plug the left display into pin 24 on connector P9
# Plug the right display into pin 21 on connector P9
if [ -f /sys/devices/bone_capemgr*/slots ]; then
# Create and setup the UART devices if needed
if [ -f /dev/ttyO1 ]; then
echo BB-UART1 >/sys/devices/bone_capemgr*/slots
@smarthall
smarthall / gist:7867898
Created December 9, 2013 05:56
Easy function for switching/making Python Virtualenvs. Put in your ~/.bashrc
function pve {
VENVFILE="$HOME/usr/venv/$1/bin/activate"
if [ -f $VENVFILE ]; then
source $VENVFILE
else
virtualenv $HOME/usr/venv/$1
source $VENVFILE
fi
}
http://filamentgroup.com/lab/responsive_design_approach_for_complex_multicolumn_data_tables/
@smarthall
smarthall / 0_reuse_code.js
Created June 21, 2014 12:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console