Skip to content

Instantly share code, notes, and snippets.

View chrismatthieu's full-sized avatar
🚀
Hacking the metaverse!

Chris Matthieu chrismatthieu

🚀
Hacking the metaverse!
View GitHub Profile
function skynet (config, cb) {
if (!cb && typeof config === 'function') {
cb = config
config = {}
}
function loadScript(url, callback)
{
// Adding the script tag to the head as suggested before
var head = document.getElementsByTagName('head')[0];
@chrismatthieu
chrismatthieu / gist:4825318dd126107bd09a
Last active August 29, 2015 14:04
Example of writing and reading sensor data on Meshblu
curl -X POST http://skynet.im/devices
{"ipAddress":"72.44.240.228","uuid":"641ddf90-1dab-11e4-892c-43aa68a33343","timestamp":"2014-08-06T20:51:08.424Z","token":"r3oen29jq0110pb97pspngm0w5e6zuxr","channel":"main","online":false}
curl -X POST -d "wind=12&temperature=78" http://skynet.im/data/641ddf90-1dab-11e4-892c-43aa68a33343 --header "skynet_auth_uuid: 641ddf90-1dab-11e4-892c-43aa68a33343" --header "skynet_auth_token: r3oen29jq0110pb97pspngm0w5e6zuxr"
{"timestamp":"2014-08-06T20:53:21.818Z","uuid":"641ddf90-1dab-11e4-892c-43aa68a33343","wind":"12","temperature":"78","ipAddress":"72.44.240.228","eventCode":700,"_id":"53e295c19f716f0f7477688d"}
curl -L -X GET http://skynet.im/data/641ddf90-1dab-11e4-892c-43aa68a33343 --header "skynet_auth_uuid: 641ddf90-1dab-11e4-892c-43aa68a33343" --header "skynet_auth_token: r3oen29jq0110pb97pspngm0w5e6zuxr"
curl -L -X GET --header "skynet_auth_uuid: 641ddf90-1dab-11e4-892c-43aa68a33343" --header "skynet_auth_token: r3oen29jq0110pb97pspngm0w5e6zuxr" "http://skynet.im/data/641ddf90-1dab-11e4-892c-43aa68a33343?start=2013-08-06T20:50:21.818Z&finish=2013-08-06T20:60:21.818Z"
sudo npm install alljoyn
npm WARN package.json jade@0.26.1 No README data
npm WARN package.json nodeconf2013@0.0.0 No repository field.
npm WARN package.json wave@0.2.3 'repositories' (plural) Not supported. Please pick one as the 'repository' field
npm WARN package.json wemo@0.1.0 No repository field.
npm WARN package.json websocket-stream@0.2.0 No repository field.
npm WARN package.json wemonode@1.0.11 No repository field.
npm WARN package.json pusher-pipe@0.0.10 No README data
> alljoyn@0.0.0 install /usr/local/src/node_modules/alljoyn
MONGODB_URI=mongodb://localhost:27017/skynet \
SSL_CERT=../meshblu-certs/skynet.im/server.crt \
SSL_KEY=../meshblu-certs/skynet.im/server.key \
REDIS_HOST=localhost \
REDIS_PORT=6379 \
COAP_PORT=5683 \
COAP_HOST=localhost \
MQTT_DATABASE_URI=mqtt.octoblu.com \
MQTT_PORT=1883 \
MQTT_PASSWORD="987...777" \
@chrismatthieu
chrismatthieu / coap
Created August 27, 2014 23:51
Meshblu Runtime Environment Variables
MONGODB_URI=mongodb://localhost:27017/skynet \
SSL_CERT=../meshblu-certs/skynet.im/server.crt \
SSL_KEY=../meshblu-certs/skynet.im/server.key \
REDIS_HOST=localhost \
REDIS_PORT=6379 \
COAP_PORT=5683 \
COAP_HOST=localhost \
MQTT_DATABASE_URI=mqtt.octoblu.com \
MQTT_PORT=1883 \
MQTT_PASSWORD="987...777" \
/*
* SSSSS kk tt
* SS kk kk yy yy nn nnn eee tt
* SSSSS kkkkk yy yy nnn nn ee e tttt
* SS kk kk yyyyyy nn nn eeeee tt
* SSSSS kk kk yy nn nn eeeee tttt
* yyyyy
*
* SkynetClient for http://skynet.im, OPEN COMMUNICATIONS NETWORK & API FOR
* THE INTERNET OF THINGS.
conn.gatewayConfig({
uuid: 'gateway-uuid',
token: 'gateway-token',
method: 'createSubdevice',
type: 'skynet-bean',
name: 'bean'
}, function(results){ console.log(results); });
msg.subdevice = "blink1";
if (msg.payload.score > 0) {
var color = "green";
} else if (msg.payload.score < 0){
var color = "red";
} else if (msg.payload.score === 0){
var color = "blue";
}
msg.payload = {"on":true, "color": color};
return msg;
@chrismatthieu
chrismatthieu / gist:7e5b104a634c4268dae6
Created February 27, 2015 16:22
Send Tessel GPS to Octoblu
/**********************************************************
This gps example logs a stream of data:
coordinates, detected satellites, timestamps, and altitude.
For best results, try it while outdoors.
**********************************************************/
var tessel = require('tessel');
var gpsLib = require('gps-a2235h');
var request = require('request');
var querystring = require('querystring');