Skip to content

Instantly share code, notes, and snippets.

Avatar
🛠️
Hardline

Zachary Crockett towynlin

🛠️
Hardline
View GitHub Profile
@towynlin
towynlin / set-pebble-time.py
Created Jul 5, 2019
I just wanted to set the time on my pebble, but there's no more app on the play store. So, after some fun searching, reading, learning, trial, and error...
View set-pebble-time.py
import sys
import time
from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.serial import SerialTransport
from libpebble2.protocol.base import PebblePacket
from libpebble2.protocol.base.types import *
from libpebble2.protocol.system import *
pebble = PebbleConnection(SerialTransport(sys.argv[1])) # argument like /dev/cu.Pebble...
pebble.connect()
@towynlin
towynlin / multicast-demo.ino
Created Nov 30, 2016
Multicast demo between several Photons on the same local network
View multicast-demo.ino
const int multicastPort = 23232;
const IPAddress multicastAddress(233,252,1,64);
UDP udp;
char buf[100];
void setup() {
udp.begin(multicastPort);
udp.joinMulticast(multicastAddress);
}
@towynlin
towynlin / a-b.diff
Last active Sep 30, 2015
Getting Particle Devices to have Identical Firmware
View a-b.diff
1482c1482
< 0005c90: 0b50 686f 746f 6e2d 4342 4558 ffff ffff .Photon-CBEX....
---
> 0005c90: 0b50 686f 746f 6e2d 4433 3235 ffff ffff .Photon-D325....
1499,1537c1499,1537
< 0005da0: 025f 0201 0002 8181 00c2 b20a 811d 8590 ._..............
< 0005db0: e3da cdc5 3295 4159 76e2 4b56 6a49 4489 ....2.AYv.KVjID.
< 0005dc0: 1c70 3fb1 5690 bf14 a3be 80b8 cd2b dcfd .p?.V........+..
< 0005dd0: d36d 8b65 382a baec c664 a7ea d47c 6e01 .m.e8*...d...|n.
< 0005de0: 205e 7816 af6b 8d3a 4ea9 59cc ca96 e932 ^x..k.:N.Y....2
@towynlin
towynlin / presence_announce.ino
Created Jun 1, 2015
Photon Multicast Presence Announcement from user app
View presence_announce.ino
SYSTEM_MODE(SEMI_AUTOMATIC);
UDP udp;
char binaryDeviceID[12];
const char SKIP_FROM_9_TO_A = 'a' - '9' - 1;
int presence_announcement_coap(unsigned char *buf, const char *id)
{
buf[0] = 0x50; // Confirmable, no token
buf[1] = 0x02; // Code POST
@towynlin
towynlin / mac-addr.ino
Created Mar 27, 2015
Get Spark Core MAC address any of several ways
View mac-addr.ino
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);
@towynlin
towynlin / serial-and-wifi.ino
Created Jan 17, 2015
Show both serial and Wi-Fi working together
View serial-and-wifi.ino
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 / wifi-connecting-timeout.ino
Last active Aug 29, 2015
Incorrect Spark Core Wi-Fi password timeout
View wifi-connecting-timeout.ino
SYSTEM_MODE(SEMI_AUTOMATIC);
bool wasConnecting = false;
int startedConnectingAt = 0;
void setup() {
Spark.connect();
}
void checkForTimeout() {
@towynlin
towynlin / binary-to-serial.ino
Created Oct 29, 2014
Quick Spark test app for sending binary to a Spark.function
View binary-to-serial.ino
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 / keybase.md
Created Oct 29, 2014
Keybase Proof of Identity
View keybase.md

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 / terminal.log
Created Oct 25, 2014
rubysl-openssl build error with Open SSL 1.0.1j
View terminal.log
% 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
You can’t perform that action at this time.