Skip to content

Instantly share code, notes, and snippets.

Avatar

Roberto Calderon calderonroberto

View GitHub Profile
View node-red
#!/bin/bash
### BEGIN INIT INFO
# Provides: node-red
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the node-red server
### END INIT INFO
# Can be downloaded and installed in one go by using this command
View gist:b3d4dade3aaae83a7383
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Chat</title>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.thingbroker-0.3.0.min.js"></script>
<style type="text/css">
p {color:gray;font-size:16px; font-style:bold; width:100px; height:100px; background-color:#E9E74A; float:left; margin-left:5px; margin-top:5px;padding:4px}
@calderonroberto
calderonroberto / Get Raw Sensor Data From WoTKit
Last active Aug 29, 2015
A simple python script to retrieve raw sensor data from wotkit.
View Get Raw Sensor Data From WoTKit
#!/bin/python
import httplib, urllib, base64, json
#TODO: ADD YOUR SENSOR NAME AND CREDENTIALS
SENSOR_NAME = 'mike.yvr-arrive'
USERNAME = 'YOURUSERNAME'
PASSWORD = 'YOURPASSWORD'
HOST = 'wotkit.sensetecnic.com'
auth = base64.encodestring('%s:%s' % (USERNAME, PASSWORD)).replace('\n', '')
@calderonroberto
calderonroberto / Data Anallysis of Real-World Data With WoTKit and Pandas
Last active Aug 29, 2015
Performing statistical data analysis on real-world data using the power of Python and Pandas on WoTKit sensor data.
View Data Anallysis of Real-World Data With WoTKit and Pandas
#!/bin/python
import httplib, urllib, base64, json
import pandas as pd
#TODO: ADD YOUR SENSOR NAME AND CREDENTIALS
SENSOR_NAME = 'mike.yvr-arrive'
USERNAME = 'YOURWOTKITUSERNAME'
PASSWORD = 'YOUROWOTKITPASSWORD'
HOST = 'wotkit.sensetecnic.com'
@calderonroberto
calderonroberto / README.md
Last active Aug 29, 2015
Public WoTKit-powered API
View README.md

A public API endpoint using WoTKit data to compute average sensor values.

@calderonroberto
calderonroberto / Node-RED Function as API controller.
Last active Aug 29, 2015
A function node for Node-RED that assembles data from WoTKit to create an HTTP request.
View Node-RED Function as API controller.
// Return an error if data is empty.
if (msg.payload.length === 0){
msg.payload = {"error":"no data found"};
return msg;
}
// Get the values as an array
var values = []
var sensors = []
msg.payload.map(function(element){
@calderonroberto
calderonroberto / app_tests.py
Created Jun 13, 2015
Flask Redis Example Tests
View app_tests.py
import app
import unittest
import json
from random import randint
mocked_value = randint(0,255)
class AppTestCase(unittest.TestCase):
def setUp(self):
self.app = app.app.test_client()
View stsplatform_example.py
#!/bin/python
import stsplatform.client as sts
SENSOR_NAME = 'mike.yvr-arrive'
def main():
conf = {
"url":"http://wotkit.sensetecnic.com/api",
}
View stsplatform_fullexample.py
#!/bin/python
import random
import stsplatform.client as sts
# You will need your credentials configured here. Read more here:
# http://wotkit.readthedocs.org/en/latest/api_v1/api_authentication.html#keys-and-basic-authentication
KEY_ID = ''
KEY_PASSWORD = ''
@calderonroberto
calderonroberto / stsplatform-ruby-example.rb
Created Jul 29, 2015
Example using the stsplatform ruby library.
View stsplatform-ruby-example.rb
# Require the stsplatform gem. Make sure to install it
# To install from source run: "bundle exec rake install"
# to install from RubyGems run : "gem install stsplatform"
require 'stsplatform'
# A sensor to use for this example. We will use
SENSOR_NAME = 'calderonroberto.demo'
# First, create a client that will handle all the REST calls
c = STSPlatform::Client.new()