Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am algrs on github.
  • I am algrs (https://keybase.io/algrs) on keybase.
  • I have a public key ASAVvYRWMxMrMWiFJ1PNe_bmL1BA9dH9b75N6O2NJiRmHQo

To claim this, I am signing this object:

const int ledPin = 13; // Pin 13: Teensy 3.0 has the LED on pin 13
const int buttonPin = 2; // Attach a N.O. momentary pushbutton that connects to ground
const int BUTTON_UP = 0;
const int BUTTON_DOWN = 1;
int buttonState = BUTTON_UP;
elapsedMillis sincePress;
void setButtonState(int newButtonState) {
if (newButtonState != buttonState && sincePress > 100) {
if (newButtonState == BUTTON_UP) {
@algrs
algrs / iphoto_faces_graph.rb
Created January 25, 2011 15:06
Relationship graphs from iPhoto '11 face detections
#!/usr/bin/env ruby
require 'rubygems'
# sudo gem install ruby-graphviz
# sudo port install graphviz
require 'graphviz'
# NB: The following line deals with the case where your iPhoto library is not in the usual place.
# If you have more than one iPhoto libraries, please set this manually.
IPHOTO_LIBRARY = `mdfind "kMDItemKind == 'iPhoto Library' && kMDItemContentTypeTree == com.apple.package"`.strip
LIBRARY = File.join(IPHOTO_LIBRARY, "Database", "Library.apdb")