Skip to content

Instantly share code, notes, and snippets.

View spilth's full-sized avatar
👽
spilth.org

Brian Kelly spilth

👽
spilth.org
View GitHub Profile
@spilth
spilth / tweets.rb
Created April 15, 2014 00:53
Playing with InfluxDB and my Twitter data
require 'date'
require 'CSV'
require 'influxdb'
influxdb = InfluxDB::Client.new "twitter"
influxdb.delete_database("twitter")
influxdb.create_database("twitter")
CSV.foreach("data/tweets.csv", {headers: true}) do |row|
data = {
@spilth
spilth / gameShowBuzzers
Created October 12, 2014 16:25
Game Show Buzzer Code for https://vimeo.com/108712810
const int player1Button = A0;
const int player2Button = A1;
const int player1Led = 5;
const int player2Led = 9;
int player1ButtonState = 0;
int player2ButtonState = 0;
void setup() {
@spilth
spilth / gist:9d3aef8569822268a10c
Created October 19, 2014 21:33
littleBits Arduino Slider Scale Jam
const int sliderInput = A0;
const int oscillator = 5;
void setup() {
pinMode(oscillator, OUTPUT);
Serial.begin(9600);
}
int scale[] = {12, 20, 32, 40, 48, 60, 68, 80, 88, 96, 108};
@spilth
spilth / gist:8b40c130d1bd857ee76f
Created October 20, 2014 02:24
littleBits EasyJam w/Scale Selector
const int noteSelector = A0;
const int oscillator = 5;
const int scaleSelector = A1;
const int barGraph = 9;
int scaleA[] = {0, 2, 4, 5, 7, 9, 11, 12, 12 + 2, 12 + 4, 12 + 5, 12 + 7, 12 + 9, 12 + 11, 12 + 12};
int scaleB[] = {0, 2, 3, 5, 7, 8, 10, 12, 12 + 2, 12 + 3, 12 + 5, 12 + 7, 12 + 8, 12 + 10, 12 + 12};
int scaleC[] = {0, 2, 5, 7, 9, 12, 12 + 2, 12 + 5, 12 + 7, 12 + 9, 12 + 12};
int scaleD[] = {0, 3, 5, 6, 7, 10, 12, 12 + 3, 12 + 5, 12 + 6, 12 + 7, 12 + 10, 12 + 12};
@spilth
spilth / cloudbit_client.rb
Last active August 29, 2015 14:08
CloudBit Client - run`gem install rest_client` first.
# USAGE:
# require './cloudbit_client'
# client = CloudBitClient.new('your_api_token', 'your_device_id')
# client.output(100)
# client.output(50, 3000)
require 'rest_client'
class CloudBitClient
def initialize(api_token, device_id)
require 'arduino_firmata'
require 'l8'
l8 = L8::Smartlight.new "/dev/ttyACM0"
puts "Connected to L8"
l8.clear_matrix
l8.set_brightness(:low)
arduino = ArduinoFirmata.connect "/dev/ttyACM1"
puts "Connected to Arduino"
@spilth
spilth / maven-cookbook.md
Last active August 29, 2015 14:24
Maven Cookbook

Default Maven Goal

Want to just type mvn on the command-line instead of mvn clean verify every time?

Add the following to your pom.xml:

<project>
    <build>
        <defaultGoal>clean verify</defaultGoal>
@spilth
spilth / hibernate-cookbook.md
Last active August 29, 2015 14:24
Hibernate Cookbook

Hibernate Cookbook

Hexadecimal Date Field Error

Your member variable is using the class org.joda.time.DateTime instead of java.util.Date

Allow for Wrapping SQL Statements in import.sql

By default, Hibernate does not allow for SQL statements that span multiple lines.