Skip to content

Instantly share code, notes, and snippets.

View johnnyman727's full-sized avatar

Jon johnnyman727

View GitHub Profile
@johnnyman727
johnnyman727 / arcadia.py
Last active August 10, 2022 13:05 — forked from alejoar/arcadia.py
Python Webhook signature validation for Arc
import hashlib
import hmac
import time
import starlette
WEBHOOK_SIGNING_KEY = "<YOUR_WEBHOOK_SIGNING_KEY>"
SECONDS_TO_STALE = 300 # 5 minutes

Construction

let mut tessel = Tessel::new();

#I2C

// Perhaps we want an Option here for frequency?
let i2c = tessel.port.a.I2C(address: u8, frequency: u32);
// Sending a buffer, no return val
@johnnyman727
johnnyman727 / openwrt-sdk-osx-compile.md
Last active June 16, 2019 19:29
Steps for compiling the OpenWRT SDK on OSX
  1. Install dependencies: brew install sdl openssl gettext
  2. Add the bin folder of gettext to your path: export PATH=$PATH:/usr/local/Cellar/gettext/0.19.4/bin
  3. Go through steps 1-9 here
  4. git clone --recursive https://github.com/tessel/openwrt-tessel.git
  5. cd openwrt-tessel
  6. Replace openwrt/tools/mkimage/Makefile with the file included in this Gist of the similar name (an artifact of OSX being unable to link against SSL development headers). Make sure to change lines 35 and 36 with a valid link to the openssl library brew installed in the previous step, if necessary. I created it by combining this debugging suggestion which didn't work and this updated file on master which also didn't work on its own.
  7. make V=99
/Applications/Xcode.app/Contents/
@johnnyman727
johnnyman727 / rust-on-tessel.md
Last active July 26, 2016 21:41
The current state of running Rust on Tessel.

What I did to get the leaf project running on my Macbook Air (which has an Intel GPU):

  • git clone https://github.com/autumnai/collenchyma.git // Checkout the library for abstracting GPU/Native implementations
  • cd collenchyma; git remote add j https://github.com/johnnyman727/collenchyma.git; git fetch j; git checkout correct-commit // Check out commit that fixes OSX builds
  • Open Cargo.toml in a text editor and remove "cuda" from this line // Macbook Air's don't have NVidia GPUs so CUDA is useless
  • cd ../; git clone https://github.com/autumnai/collenchyma-blas.git; cd collenchyma-blas // Enter our BLAS Plugin directory
  • Open Cargo.toml in a text editor and add path = "../collenchyma" as a property to this line // Use our local version with fix for OSX
  • Once again, remove "cuda" fr
@johnnyman727
johnnyman727 / sound-meter.js
Created November 5, 2014 17:25
Animates a strip of Neopixels according to how loud an environment is.
var tessel = require('tessel');
var ambientLib = require('ambient-attx4');
var animations = require('neopixel-animations');
var Neopixels = require('neopixels');
var neopixels = new Neopixels();
var ambient = ambientLib.use(tessel.port.A);
var numLEDs = 60;
var helpFactor = 10;
@johnnyman727
johnnyman727 / for_fang.js
Created October 14, 2014 02:35
Many Modules
require('tesselate')(['ble-ble113a', 'climate-si7020', 'ambient-attx4', 'camera-vc0706'], function(tessel, modules) {
console.log('connected!');
modules.climate.readTemperature(message, function (err, temp) {
modules.climate.readHumidity(function (err, humid) {
console.log(temp + ":" + humid);
modules.ambient.getLightLevel(function (err, ldata) {
if (err)
throw err;
modules.ambient.getSoundLevel(function (err, sdata) {
@johnnyman727
johnnyman727 / listening-client.js
Created September 23, 2014 19:57
Simple MQTT Server. Tessel acts as an MQTT client sending temperature data to a host
var mqtt = require('mqtt')
// Make sure to change this to the IP address of your MQTT server
, host = '192.168.128.204' // or localhost
client = mqtt.createClient(1883, host, {keepalive: 10000});
// Subscribe to the temperature topic
client.subscribe('temperature');
// When a temperature is published, it will show up here
client.on('message', function (topic, message) {
@johnnyman727
johnnyman727 / tessel-button.js
Created August 29, 2014 06:30
Make a POST when Tessel's Config button is pressed.
var tessel = require('tessel'),
http = require('http');
var options = {
method : 'POST',
host : 'YOUR_HOST_HERE',
port : 'YOUR_PORT_HERE',
path : 'YOUR_PATH_HERE'
};
@johnnyman727
johnnyman727 / node-bliny.js
Created July 27, 2014 18:14
Blink the Tessel LED over WiFi
var http = require('http');
var state = 1;
function toggleLED() {
// Change the IP Address to your Tessel's IP Address!
var path = 'http://172.20.10.5:8080/green/' + state
console.log('getting at', path);
http.get(path, function(res) {