Skip to content

Instantly share code, notes, and snippets.

#include <Servo.h>
#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>
//16-bit colors, not quite HTML codes even though they look like it... It's a pain:
//http://en.wikipedia.org/wiki/High_color#16-bit_high_color
#define SAMSUNG_BLUE 0x1111
#define SAMSUNG_CYAN 0x0d3c
#define SAMSUNG_GREY 0xbdd7
@theterg
theterg / gist:5797669
Created June 17, 2013 15:13
Bugcommunity/bugops domains
api.buglabs.net
community.buglabs.net
communityasset0.buglabs.net
communityasset1.buglabs.net
communityasset2.buglabs.net
communityasset3.buglabs.net
cvs.buglabs.net
demo.buglabs.net
demo-ws.buglabs.net
repository.buglabs.net
@theterg
theterg / gist:5496696
Created May 1, 2013 17:18
Bike Air Quality message format
Location is the same as normal, but with some extra data that isn't strictly necessary
{
'feed': {
'latitude': '',
'satellites': 0,
'valid': False,
'longitude': ''
},
'name': 'Location'
@theterg
theterg / SleepPulseFirmware.ino
Last active December 15, 2015 19:49
SleepPulseFirmware.ino
/*
* Sleep Pulse Firmware - firmware code for the Sleep Pulse Device.
* This runs on an Atmel 328P microprocessor, at 5 volts, with a 16 MHz crystal
* Within the arduino IDE, select "Arduino Pro or Pro Mini (5V, 16MHz) w/ATmega328" as the Board
*/
#include <math.h>
#include <EEPROM.h>
// Prototype pin definitions - don't change these!
@theterg
theterg / helloworld.html
Created April 3, 2013 15:23
bugswarm helloworld example, cleaned up and demonstrating arbitrary key value
<html>
<head>
<script type="text/javascript" src="http://cdn.buglabs.net/swarm/swarm-v0.4.0.js"></script>
</head>
<body>
<script>
/* Open this file twice or more and you should be able
to see presence in the developer console of your browser. */
function onPresence(presence) {
console.log('presence -> ' + Date.now() + ':' + JSON.stringify(presence));
@theterg
theterg / RL78_serial_remote.py
Last active December 29, 2018 12:29
Reverse-engineered pyusb code to read from a renesas RL78G13 promotion board. It uses some random MCU as a debug/programmer tool and a USB->serial device. Windows drivers only. All of the ctrl_transfers were sniffed using wireshark inbetween a windows VM.
import usb.core
import usb.util
import sys
from commands import getstatusoutput
import json
# find our device
dev = usb.core.find(idVendor=0x045b, idProduct=0x0212)
# was it found?
if dev is None:
@theterg
theterg / gist:5017229
Created February 22, 2013 22:49
BUG OSGI java reset a BMI port
public void run(Map<Object, Object> services) {
IVonHippelModuleControl vh = (IVonHippelModuleControl) services.get(IVonHippelModuleControl.class.getName());
System.out.println("sysfstest start");
try {
vh.setIOX(0);
vh.setIOX(1);
vh.setIOX(2);
vh.setIOX(3);
} catch (IOException e) { e.printStackTrace(); }
try {
@theterg
theterg / gist:5016797
Created February 22, 2013 21:48
Autoreconnect + keepalive TCP dump
POST /stream?resource_id=c7cf00fc21622a15f15bd390a698af3f34efd9bc&swarm_id=0d86ad8e7f33d4c9bb33d38ef9295f897a636523 HTTP/1.1
Host: api.bugswarm.net
Accept: application/json
X-BugSwarmApiKey: 7a849e6548dbd6f8034bb7cc1a37caa0b1a2654b
Connection: close
User-Agent: SwarmSessionImp
Transfer-Encoding: chunked
Content-Type: application/json ;charset=UTF-8
X-Forwarded-For: 69.195.32.42
var WebSocket = require('ws')
, ws = new WebSocket('ws://api.cosm.com:8080/');
var API_KEY = "" //ENTER API KEY HERE.
ws.on('open', function() {
ws.send('{"headers":{"X-ApiKey":"'+API_KEY+'"}, "method":"subscribe", "resource":"/feeds/61916/datastreams/sine60"}');
});
ws.on('message', function(message) {
console.log('received: %s', message);
});
@theterg
theterg / LED_VU_BT_firmware.pde
Created September 29, 2012 07:42
LED VU BT firmware with animation upgrades
#define BUFFLEN 200
#define NUMLEDS 5
#define MAXVALUES 3
#define ACT_FADEUP 1
#define ACT_FADEDOWN 2
#define ACT_BLINK 3
int leds[] = {3, 5, 6, 9, 10};
int act[NUMLEDS];