Skip to content

Instantly share code, notes, and snippets.

View azdle's full-sized avatar

Patrick Barrett azdle

View GitHub Profile
@azdle
azdle / Agent Code
Last active December 18, 2015 07:59
Exosite Imp Agents Tests Reads respond with error code 52 (CURLE_GOT_NOTHING)
// Class for Communication to Exosite
class Exosite{
//Set CIK Manually Here or
cik = "654a29f2f230a2810a28036f79ab2fef17c058c4";
// Set Provisioning Parameters to Automatically Generate New CIK
vendor = null;
model = null;
serial = null; // Consider hardware.getimpeeid() or imp.getmacaddress()
@azdle
azdle / euler_003.rs
Created June 14, 2013 16:38
Project Euler Problem 3 in Rust using MutList
#!/usr/local/bin/rust run
/**
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
*/
extern mod extra;
@azdle
azdle / Exosite.agent
Created June 18, 2013 21:23
Exosite Demo Application for the Electric Imp
// Class for Communication to Exosite
class Exosite{
cik = null;
vendor = null;
model = null;
serial = null; // Consider hardware.getimpeeid() or imp.getmacaddress()
constructor(cikp = null, vendorp = null, modelp = null, serialp = null){
if(cikp == null){
server.log("No CIK, need to provision.")
@azdle
azdle / Query.py
Created June 20, 2013 14:00
Windowed Exosite Query In Python
#!/usr/bin/python
import socket, ssl
header = """POST /api:v1/rpc/process HTTP/1.1
Host: m2.exosite.com
Content-Type: application/json; charset=utf-8
Content-Length: """
content = """{
@azdle
azdle / JSON Widget.js
Created August 22, 2013 13:32
JSON Editor Widget for Exosite Portals
// select one or more data sources from the list above to view this demo.
function( container, portal )
{
console.log("Script Started")
var settings_datasource = "sws"
var messageBox = document.createElement("div");
messageBox.style.display = "none";
messageBox.style.position = "absolute";
@azdle
azdle / nPages.py
Last active December 23, 2015 00:49
PyQt Problem -- Fixed with Help From Ryan Hanson on PyQt Mailing List
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
pages = [
"https://portals.exosite.com/views/3819798770/3579834479",
"https://portals.exosite.com/views/2562112089/4128069106",
"https://portals.exosite.com/views/2060811893/1760385000",
"https://exosite:AKYQhkDqj4@logs.exosite.com:444"
@azdle
azdle / appinfo.json
Created November 17, 2013 23:35
Pebble App Message Problem
{
"uuid": "14683333-c12a-451d-ad88-307d8a7e8384",
"shortName": "Test App",
"longName": "Test App",
"companyName": "Me",
"versionCode": 1,
"versionLabel": "0.0.1",
"watchapp": {
"watchface": false
},
@azdle
azdle / Exosite.agent
Last active August 29, 2015 13:56
A very simple example showing how to use the Electric Imp with Exosite.
// Class for Communication to Exosite - No Need to Edit
class Exosite{
cik = null;
vendor = null;
model = null;
serial = null; // Consider hardware.getimpeeid() or imp.getmacaddress()
constructor(cikp = null, vendorp = null, modelp = null, serialp = null){
if(cikp == null){
server.log("No CIK, need to provision.")
@azdle
azdle / washer_dryer_monitor.ino
Created April 3, 2014 00:43
Monitoring Power with Exosite using an Arduino Yun
//*****************************************************************************
//
// wifi_read_write_string - A Simple read/write to the Exosite Cloud API
// for the Arduino WiFi shield using the
// String library
//
// Copyright (c) 2013 Patrick Barrett - All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
@azdle
azdle / coap.erl
Last active August 29, 2015 14:04
CoAP Message Parsing in Erlang
coap(<<Version:2, Type:2, TKL: 4, Code:8, MID:16, Token:TKL/bytes, Tail/bytes>>) when Version =:= 1->
{Options, Payload} = coap_parse_options(Tail),
{coap, {Type, Code, MID, Token, Options, Payload}}.
coap_parse_options(OptionBin) ->
coap_parse_options(OptionBin, 0, []).
coap_parse_options(<<>>, _LastNum, OptionList) ->
{OptionList, <<>>};
coap_parse_options(<<16#FF, Payload/bytes>>, _LastNum, OptionList) ->