Skip to content

Instantly share code, notes, and snippets.

View towynlin's full-sized avatar

Zachary Crockett towynlin

View GitHub Profile
@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 / 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 / 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
@towynlin
towynlin / terminal.log
Created October 25, 2014 04:53
rubysl-openssl build error with Open SSL 1.0.1j
% gem update rubysl-openssl -- --with-openssl-dir=/usr/local/Cellar/openssl/1.0.1j
Updating installed gems
Updating rubysl-openssl
Building native extensions with: '--with-openssl-dir=/usr/local/Cellar/openssl/1.0.1j'
This could take a while...
ERROR: Error installing rubysl-openssl:
ERROR: Failed to build gem native extension.
/Users/zac/.rbenv/versions/rbx-2.2.10/bin/rbx extconf.rb --with-openssl-dir=/usr/local/Cellar/openssl/1.0.1j
checking for t_open() in -lnsl... no
@towynlin
towynlin / keybase.md
Created October 29, 2014 19:50
Keybase Proof of Identity

Keybase proof

I hereby claim:

  • I am towynlin on github.
  • I am towynlin (https://keybase.io/towynlin) on keybase.
  • I have a public key whose fingerprint is 6477 2407 CE3A 48C0 2D32 0DD9 585E 75DD 1E3E 7AA1

To claim this, I am signing this object:

@towynlin
towynlin / binary-to-serial.ino
Created October 29, 2014 23:46
Quick Spark test app for sending binary to a Spark.function
int binaryToSerial(String s) {
int len = s.length();
for (int i=0; i < len; i++) {
Serial.write(s[i]);
Serial.write(' ');
Serial.println(s[i], HEX);
}
return len;
}
@towynlin
towynlin / wifi-connecting-timeout.ino
Last active August 29, 2015 14:11
Incorrect Spark Core Wi-Fi password timeout
SYSTEM_MODE(SEMI_AUTOMATIC);
bool wasConnecting = false;
int startedConnectingAt = 0;
void setup() {
Spark.connect();
}
void checkForTimeout() {
@towynlin
towynlin / serial-and-wifi.ino
Created January 17, 2015 03:20
Show both serial and Wi-Fi working together
int last = 0;
char buf[256];
int toSerial(String s) {
Serial.print("You said via REST API: ");
Serial.println(s);
memset(buf, 0, 256);
int charsRead = 0;
while (Serial.available() && charsRead < 255) {
@towynlin
towynlin / mac-addr.ino
Created March 27, 2015 00:57
Get Spark Core MAC address any of several ways
static char macString[18];
static int t = 0;
static bool printed = false;
void setup() {
Spark.variable("mac", macString, STRING);
Serial.begin(115200);
byte mac[6];
WiFi.macAddress(mac);