Skip to content

Instantly share code, notes, and snippets.

@shervinshaikh
shervinshaikh / gist:5b50f01a5cc419a03686
Last active August 29, 2015 14:05
Bug - Reading sensor data on Meshblu
// Asking for data between 1970-01-01 and 2033-10-28, which should return the same json as the next curl yet it says "data not found"
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=1970-01-01&finish=2033-10-28"
{"message":"Data not found","code":404}
// Asking for last few data points, should return whatever exists
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"
{"data":[{"timestamp":"2014-08-07T18:09:40.607Z","uuid":"641ddf90-1dab-11e4-892c-43aa68a33343","start":"2014-08-05T20:50:21.818Z","finish":"2014-08-05T20:60:21.818Z","ipAddress":"216.219.125.1","id":"53e3c0e4d08eb19909eaa171"},{"timestamp":"2014-08-06T20:53:21.818Z","uuid":"641ddf90-1dab-11e4-892c-43aa68tia33343","wind":"12","tempera
var skynet = require('skynet');
var Firebase = require('firebase');
var myRootRef = new Firebase('https://zapier-shervin.firebaseio.com/glass');
var conn = skynet.createConnection({
"uuid": "adcf9640-f71a-11e3-a289-c9c410d2a47e",
"token": "0c4liaas7dum78pviw7ovh5pvc4k7qfr",
"protocol": "websocket"
});
const YO_API_TOKEN = "YO_API_TOKEN_GOES_HERE";
device.on("yo", function(nothing) {
local url = "http://api.justyo.co/yoall/";
local body = "api_token=" + YO_API_TOKEN;
local req = http.post(url, {}, body);
local res = req.sendsync();
if(res.statuscode != 201) {
/**
* test2
*
* Copyright 2014 Shervin Shaikh
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
var skynet = require('skynet');
var request = require('request');
// http://[BRIDGE_IP_ADDRESS_HERE]/api/[DEV_USERNAME_HERE]/lights/
var bridgeURI = 'http://10.1.169.87/api/shervinshaikh/lights/'; // Must find IP address of Hue Bridge & create dev username
var conn = skynet.createConnection({
"uuid": "adcf9640-f71a-11e3-a289-c9c410d2a47e",
"token": "0c4liaas7dum78pviw7ovh5pvc4k7qfr",
"protocol": "websocket"
/**
* Welcome to HuePebble
*
* Created By: Shervin Shaikh
* Sends a message to MeshBlu (formerly SkyNet) to turn off Philips Hue lights from anywhere in the world!
* There needs to be a client on the LAN of where the lights are on to listen for the incoming messages.
*
* This code is from the app.js source file on a CloudPebble project.
* Just create a new Pebble.js project and replace app.js with the code below, then build & run.
*/
@shervinshaikh
shervinshaikh / april.agent.nut
Last active August 29, 2015 14:04
Electric Imp - Yo all subscribers on button press
const YO_API_TOKEN = "api_token_goes_here";
device.on("yo", function(nothing) {
local url = "http://api.justyo.co/yoall/";
local body = "api_token=" + YO_API_TOKEN;
local req = http.post(url, {}, body);
local res = req.sendsync();
if(res.statuscode != 201) {
@shervinshaikh
shervinshaikh / gist:5507471
Last active December 16, 2015 22:29
Script for submitting project 2 for CS154 from a non-CSIL computer.
#!/bin/sh
# Script to submit project 2 for CS154
# Written By: Shervin Shaikh
# make sure to run this command to allow it to be an executable: chmod 755 submit.sh
# then execute the script with: ./submit.sh
SERVER="csil.cs.ucsb.edu"
USER="your_username"
LOCATION="cs154/p2"