Skip to content

Instantly share code, notes, and snippets.

View azdle's full-sized avatar

Patrick Barrett azdle

View GitHub Profile
@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 / campsites_sht.geojson
Created May 16, 2016 23:21
Superior Hiking Trail as GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@azdle
azdle / main.rs
Last active January 14, 2017 20:07
UDP Doubler
extern crate futures;
extern crate tokio_core;
extern crate env_logger;
use std::str;
use std::io::{Result, Error, ErrorKind, Write};
use std::net::SocketAddr;
use futures::{Stream, Sink};
use tokio_core::net::{UdpSocket, UdpCodec};
### Keybase proof
I hereby claim:
* I am azdle on github.
* I am psbarrett_st (https://keybase.io/psbarrett_st) on keybase.
* I have a public key ASAOtRdhF-9oHcFeX3FrkhM5E3TKGl7B-BIGTjoeybR_4go
To claim this, I am signing this object:
@azdle
azdle / configuration.nix
Last active February 8, 2018 23:55
QEMU Guest Base NixOS Config
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
/// This is a marker type that allows us to mark a Vec<u8> as one that should be converted into
/// a Lua string type.
#[derive(Clone, Debug)]
pub struct ByteString(Vec<u8>);
impl From<Vec<u8>> for ByteString {
fn from(vec: Vec<u8>) -> Self {
ByteString(vec)
}
}