Skip to content

Instantly share code, notes, and snippets.

View dpjanes's full-sized avatar

David Janes dpjanes

View GitHub Profile

Keybase proof

I hereby claim:

  • I am dpjanes on github.
  • I am dpjanes (https://keybase.io/dpjanes) on keybase.
  • I have a public key whose fingerprint is FB91 1EE6 3F32 CE3D 0C58 48A8 98F2 8D83 B36B F173

To claim this, I am signing this object:

@dpjanes
dpjanes / repeat-3.js
Created August 10, 2015 21:33
Cookbook / Recipe Example
/*
* repeat-3.js
*
* David Janes
* IOTDB.org
* 2014-12-30
*
* This will broadcast Count=0, Count=1, Count=3
* when pushed.
*/
@dpjanes
dpjanes / gist:2f4cebe6a6d7aaa14ede
Last active September 17, 2015 21:24
IOTQL Example - Turn on LED when Button Pressed
CREATE THING JohnnyFiveButton WITH pin = 4, meta:name = "The Button";
CREATE THING JohnnyFiveLED WITH pin = 6, meta:name = "The LED";
CREATE RULE
LED
WHERE
meta:name = "The Button"
BEGIN
SET
state:on = $_$state:on
@dpjanes
dpjanes / NetflixChill1.iotql
Created September 29, 2015 19:35
Netflix & Chill - IoTQL Example (1)
-- this assumes that the TV supports Netflix (my LG does)
CREATE SCENE
NetflixChill
BEGIN
SET
state:on = true,
state:band = iot-attribute:band.service.netflix
WHERE
meta:facet & iot-facet:media.tv;
AND
@dpjanes
dpjanes / NetflixChill2.iotql
Last active September 29, 2015 19:41
Netflix & Chill #2 - with IoTQL and Views
-- CREATE VIEW not implemented yet
CREATE VIEW
LivingRoom
WHERE
meta:zone & "Living Room";
CREATE ACTION
NetflixChill
BEGIN
UPDATE
@dpjanes
dpjanes / NetflixChill3.js
Created September 29, 2015 19:45
Netflix & Chill #3 - in JavaScript
things = require('iotdb').connect()
things
.with_facet(":media.tv")
.with_zone("Living Room")
.set(":on", true)
.set(":band", ":band.service.netflix")
things
.with_facet(":lighting")
@dpjanes
dpjanes / iotdb-mqtt.js
Created January 15, 2016 16:30
Send IOTDB things to MQTT
/*
make sure to
homestar install iotdb-transport-mqtt
homestar install iotdb-transport-iotdb
(npm install will probably work too)
Further reading on transporter
https://homestar.io/about/transporters
@dpjanes
dpjanes / Working IoT Policy.json
Last active March 26, 2016 16:30
This one works
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Connect"
],
"Resource": [
"*"
@dpjanes
dpjanes / numbers.txt
Created October 21, 2016 10:26
Results from numbers.py
-31 = ( 5 ) - ( 4 * 3 ) * ( 2 + 1 )
( 5 ) - ( 4 ) * ( 3 ) * ( 2 + 1 )
-23 = ( 5 ) - ( 4 ) * ( 3 * 2 + 1 )
-21 = ( 5 - 4 * 3 ) * ( 2 + 1 )
-20 = ( 5 - 4 * 3 * 2 - 1 )
( 5 ) - ( 4 * 3 * 2 + 1 )
( 5 - 4 * 3 * 2 ) - ( 1 )
( 5 ) - ( 4 * 3 * 2 ) - ( 1 )
( 5 ) - ( 4 ) * ( 3 * 2 ) - ( 1 )
( 5 ) - ( 4 * 3 ) * ( 2 ) - ( 1 )
@dpjanes
dpjanes / numbers.py
Last active October 21, 2016 10:46
Make equations to generate numbers
# -*- coding: utf-8 -*-
#
# numbers.py
#
# David Janes
# 2016-10-21
#
# Program to solve (more generally):
#
# Take the digits 5, 4, 3, 2 and 1, in that order.