Skip to content

Instantly share code, notes, and snippets.

View todbot's full-sized avatar
💭
doing the blink1

Tod Kurt todbot

💭
doing the blink1
View GitHub Profile
@todbot
todbot / tembootest1.txt
Created April 16, 2014 23:33
this is only a test
hello there
how are you
i am wonderful.
@todbot
todbot / blink1-tool-multi-led1.sh
Last active August 29, 2015 14:21
blink1-tool --playpattern example
#!/bin/sh
# play a multi-led pattern on a blink(1) using blink1-tool commandline program
blink1-tool --playpattern "3,#ff0000,0.3,1,#000000,0.3,2,#00ff00,0.3,1,#000000,0.3,2,#0000ff,0.3,0,#000000,0.3,0"
@todbot
todbot / twitter-streaming-blink1-excerpt.js
Last active September 3, 2016 17:28
Excerpt from twitter-streaming-blink1
// Listen for favorite events
user_stream.on('favorite', function (eventMsg) {
if (eventMsg.target.screen_name = screen_name) {
console.log('@' + eventMsg.source.screen_name + ' has favorited a Tweet.');
blinkFavorite();
}
});
// Listen for follow events
user_stream.on('follow', function (eventMsg) {
@todbot
todbot / test-rawhid.c
Last active November 15, 2016 00:08
Demonstrate Mac hidapi bug sending to Teensy doing RawHID sketch: https://www.pjrc.com/teensy/rawhid.html
// test-rawhid.c -- Demonstrate writing to Teensy running RawHID sketch
// On Mac, this will occasionally hang in hid_write()
//
// Build with:
// gcc -I ../hidapi/hidapi -framework IOKit -framework CoreFoundation../hidapi/mac/hid.c rawhid-test.c
//
// Tod E. Kurt / github.com/todbot
//
#include <stdio.h>
@todbot
todbot / gist:c0e6a385bba825dfe3ef395e7d556b05
Created November 15, 2016 02:39
Compiling electron-hid-toy on Mac OS X
bokbokbok% git clone https://github.com/todbot/electron-hid-toy.git
Cloning into 'electron-hid-toy'...
remote: Counting objects: 29, done.
remote: Total 29 (delta 0), reused 0 (delta 0), pack-reused 29
Unpacking objects: 100% (29/29), done.
Checking connectivity... done.
bokbokbok% cd electron-hid-toy
bokbokbok% npm install
npm WARN prefer global npm@3.10.9 should be installed with -g
@todbot
todbot / CrashSpaceSignJsonParse.swift
Created December 9, 2016 07:36
CrashSpace Sign JSON parsing in Swift
//: CrashSpace Sign JSON parsing in Swift
import Cocoa
import Foundation
let urlString = "https://crashspacela.com/sign2/json/";
let url = URL(string: urlString)
@todbot
todbot / CrashSpaceSignJsonParseStruct.swift
Last active December 9, 2016 08:26
CrashSpace Sign JSON parsing in Swift, using struct
//: CrashSpace Sign JSON parsing in Swift, using struct
import Cocoa
import Foundation
struct ButtonPress {
let id: String
let msg: String
let diff_mins: Int
let date: String
@todbot
todbot / CrashSpaceSignJsonParseStructNew.swift
Last active December 12, 2016 23:48
CrashSpace Sign JSON parsing in Swift, using struct, CrashSpace Sign JSON now returns an 'is_open' flag and a 'minutes_open' value
//: NEW CrashSpace Sign JSON parsing in Swift, using struct
// CrashSpace Sign JSON now returns an 'is_open' flag and a 'minutes_open' value
import Cocoa
import Foundation
struct ButtonPress {
let id: String
let msg: String
let diff_mins: Int
#include <FastLED.h>
#define LEDPIN D4
#define NUM_LEDS 5
CRGB leds[NUM_LEDS];
CRGB leds_virt[NUM_LEDS];
const int led_map[NUM_LEDS] = {
@todbot
todbot / demoreel100withbutton.ino
Created January 24, 2017 05:25 — forked from atuline/demoreel100withbutton.ino
Demoreel100 with a button
/*
Title: DemoReel100 with Button
By: Mark Kriegsman
Button added by: Andrew Tuline