Skip to content

Instantly share code, notes, and snippets.

View towynlin's full-sized avatar

Zachary Crockett towynlin

View GitHub Profile
@towynlin
towynlin / _debug-info.md
Last active December 14, 2015 23:49
wireshark failed to build on 10.8.3

HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install wireshark

==> Downloading http://www.wireshark.org/download/src/wireshark-1.8.6.tar.bz2
Already downloaded: /Library/Caches/Homebrew/wireshark-1.8.6.tar.bz2
tar xf /Library/Caches/Homebrew/wireshark-1.8.6.tar.bz2
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/wireshark/1.8.6 --without-python --disable-wireshark
./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/wireshark/1.8.6 --without-python --disable-wireshark
checking build system type... i386-apple-darwin12.3.0
checking host system type... i386-apple-darwin12.3.0
@towynlin
towynlin / rc-car.c
Created May 28, 2013 03:31
Spark embedded application code (like Arduino/Wiring code) to drive an RC car with the Spark API.
#include <stdlib.h>
// Motor shield instructions (set control mode jumpers to PWM mode)
// http://www.dfrobot.com/wiki/index.php?title=Arduino_Motor_Shield_(L298N)_(SKU:DRI0009)
#define LEFT A7 // Motor Shield E1, Arduino D6
#define RIGHT D1 // Motor Shield E2, Arduino D5
void setup()
{
@towynlin
towynlin / spark_core_id_listener
Created December 16, 2013 23:34
ruby listener for Spark Core multicast presence announcement
require 'socket'
require 'ipaddr'
MULTICAST_ADDR = '224.0.1.187'
PORT = 5683
ip = IPAddr.new(MULTICAST_ADDR).hton + IPAddr.new('0.0.0.0').hton
sock = UDPSocket.new
sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, ip)
@towynlin
towynlin / application.cpp
Created January 20, 2014 03:38
Spark firmware for setting RGB LED color using the Spark Tinker mobile app's analogWrite on pins A4, A5, and A6.
// Default to pinkish
int redValue = 255;
int greenValue = 33;
int blueValue = 121;
int countdown;
void showColor() {
RGB.control(true);
RGB.color(redValue, greenValue, blueValue);
@towynlin
towynlin / console-session
Created February 5, 2014 16:55
Attempting to install and run the Haskell Koans
~/code% git clone https://github.com/HaskVan/HaskellKoans.git
Cloning into 'HaskellKoans'...
remote: Reusing existing pack: 200, done.
remote: Total 200 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (200/200), 25.54 KiB | 0 bytes/s, done.
Resolving deltas: 100% (111/111), done.
Checking connectivity... done.
~/code% cd HaskellKoans
~/code/HaskellKoans% ./bin/setup-koans
Writing a default package environment file to
@towynlin
towynlin / ip_and_mac_vars.ino
Created April 18, 2014 07:10
Exposing the IP and MAC address of a Spark Core using Spark.variable()
char ipString[16];
char macString[18];
void setup() {
Spark.variable("ip", ipString, STRING);
Spark.variable("mac", macString, STRING);
byte mac[6];
Network.macAddress(mac);
sniprintf(macString, 18, "%02x:%02x:%02x:%02x:%02x:%02x",
@towynlin
towynlin / application.cpp
Created May 21, 2014 20:47
spark pebble pong draft
#include "application.h"
const char PONG_DEBUG = 1;
static char score[4] = "0-0";
static char paddle1 = 0;
static char paddle2 = 0;
bool increment_score(char player)
{
@towynlin
towynlin / spark-aes-encryption-demo.ino
Created July 31, 2014 00:07
Demo Spark Core firmware using AES-128-CBC
void sixteenRandomBytes(unsigned char buf[16]) {
for (int i = 0; i < 16; i++) {
buf[i] = rand() & 0xff;
}
}
// PKCS #7 padding
// Do this before encrypting to get the message
// up to a multiple of 16 bytes.
size_t pad(unsigned char *buf, size_t messageLength) {
@towynlin
towynlin / http-tester.ino
Created September 10, 2014 18:32
Using a Spark Core, gather testing data by making an HTTP POST request every 10 seconds
#include "application.h"
TCPClient client;
const byte SERVER[] = { 192, 168, 0, 100 }; // <-- Change to your server
const int PORT = 4567;
const char REQ_FORMAT[] = "POST / HTTP/1.0\r\n"
"Host: example.com\r\n"
"Content-Length: %d\r\n"
"\r\n%s";
const int MAX_REQ_SIZE = 256;
@towynlin
towynlin / ruby-build.20141024163757.86591.log
Created October 25, 2014 00:08
Rubinius 2.2.10 build error
/var/folders/73/f9rt6pzx2q1dgsqq_5kn6vw40000gn/T/ruby-build.20141024163757.86591 ~/code/spark/website
HTTP/1.1 200 OK
Content-Type: binary/octet-stream
Content-Length: 503012
Connection: keep-alive
Date: Thu, 23 Oct 2014 15:35:23 GMT
Last-Modified: Fri, 23 May 2014 08:48:21 GMT
ETag: "5fe00cda18ca5daeb43762b80c38e06e"
Accept-Ranges: bytes
Server: AmazonS3