Skip to content

Instantly share code, notes, and snippets.

View rubyist's full-sized avatar

Scott Barron rubyist

View GitHub Profile
package main
import (
"bufio"
"errors"
"fmt"
"os"
"strconv"
"strings"
"time"
#!/usr/bin/env ruby
require 'rubygems'
require 'parseconfig'
config = ParseConfig.new('.git/config')
url = config["remote \"origin\""]["url"]
if url =~ /^git@/
url = "https://#{url.sub!(/git@/, '').sub!(':', '/').sub!('.git', '')}"
else
@rubyist
rubyist / gist:9533110
Created March 13, 2014 17:38
keybase.md
### Keybase proof
I hereby claim:
* I am rubyist on github.
* I am rubyist (https://keybase.io/rubyist) on keybase.
* I have a public key whose fingerprint is 1B23 8186 02E1 D85F 61B7 AC94 B351 D529 7399 1682
To claim this, I am signing this object:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "light_ws2812.h"
#include <string.h>
#define LEDSPERSEG 1
#define LEDSEGMENTS 7
#define DIGITS 4
#define LEDSPERDIGIT LEDSPERSEG * LEDSEGMENTS
@rubyist
rubyist / caveatPatchor.js
Created January 22, 2014 14:49
Detect new campfire sounds
function upInThis(array, value) {
for (var i = 0; i < array.length; i++) {
if (array[i] == value) return true;
}
return false;
}
function sayItProud(msg) {
message = this.chat.transcript.insertPendingMessage(msg);
new Campfire.OutgoingMessage(this.chat, message, msg, '').send();
@rubyist
rubyist / strippy.ino
Last active January 3, 2016 20:18
LED strip as seven segment display, 3 LEDs per segment.
#include <Adafruit_NeoPixel.h>
#define PIN 8
Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800);
// LED strip, 3 LEDs per segment, standard 7 segment LED layout
unsigned long DigitBytes[] = {
0x0003FFFF, // 0
@rubyist
rubyist / button.ino
Last active January 3, 2016 02:09
Timing an interrupt driven button
#define LONGPRESS_TIME 1000 // 1 second
volatile int trackButton = 0;
volatile unsigned long buttonChangeMillis = 0;
void setup() {
attachInterrupt(0, buttonPressed, CHANGE);
}
void buttonPressed()
@rubyist
rubyist / best.ino
Last active January 1, 2016 05:39
"You're The Best" from Karate Kid. Patches for accuracy welcome.
const int buzzerPin = 6;
// Trick these 4 out for accuracy
const int songLength = 17;
char notes[] = "efg dab bbbbbaagg";
int beats[] = {1,2,5,3,2,4,2,5,2,2,2,2,3,3,3,3,2};
int tempo = 90;
// Boom. Gold.
@rubyist
rubyist / get_some.go
Created December 10, 2013 16:47
GET some
package main
import (
"fmt"
"io"
"net/http"
"os"
"strconv"
"sync"
)
(START)
@SCREEN
D=A
@cur
M=D // Sets CUR to SCREEN
(LOOP)
@KBD // read from keyboard, 0=nothing pressed
D=M