Skip to content

Instantly share code, notes, and snippets.

View smarthall's full-sized avatar

Daniel Hall smarthall

View GitHub Profile
@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
@smarthall
smarthall / gist:39d9db9392de8dbff1f8
Created October 21, 2014 05:15
Keybase Verification
### Keybase proof
I hereby claim:
* I am smarthall on github.
* I am smarthall (https://keybase.io/smarthall) on keybase.
* I have a public key whose fingerprint is A7FC 317E A9D0 5A34 45E7 2BCD 8AD9 D99E 2E0A 44E2
To claim this, I am signing this object:
@smarthall
smarthall / lifx.c
Created August 12, 2015 12:11
LIFX Packet Sending Example
#include "lifx.h"
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
@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
}