Skip to content

Instantly share code, notes, and snippets.

View WilliamBerryiii's full-sized avatar

Bill Berry WilliamBerryiii

View GitHub Profile
blueprint:
name: Lights Off (No Motion)
description: Turn off lights when multiple motion sensors are nolonger occupied
domain: automation
input:
motion_sensors:
name: Motion Sensors
description: The pair of sensors that will control the light
selector:
@WilliamBerryiii
WilliamBerryiii / dockerfile.txt
Created June 21, 2017 16:13
Dockerfile to build .netstandard 2.0 capable bindings for IoT-Edge
FROM buildpack-deps:jessie-scm
# Install .NET CLI dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libc6 \
libcurl3 \
libgcc1 \
libgssapi-krb5-2 \
libicu52 \
@WilliamBerryiii
WilliamBerryiii / dockerfile.txt
Created June 13, 2017 23:58
A dockerfile for building the Azure IoT-Edge Gateway in a container.
FROM ubuntu
# ENV vars for setup
ENV IoTHubName {iot_hub_name}
ENV IoTHubSuffix azure-devices.net
ENV device1 {device1_name}
ENV device1key {device1_key}
ENV device2 {device2_name}
ENV device2key {device2_key}
@WilliamBerryiii
WilliamBerryiii / Dockerfile
Last active May 2, 2019 01:40
Dockerfile Example for Resin.io to build & run Azure IoT-Edge Gateway
FROM resin/raspberrypi3-node
ENV INITSYSTEM=on
# Update image
RUN apt-get update
RUN apt-get install curl build-essential libcurl4-openssl-dev git cmake pkg-config libssl-dev uuid-dev valgrind jq libglib2.0-dev libtool autoconf autogen vim
# Checkout code
WORKDIR /usr/src/app
@WilliamBerryiii
WilliamBerryiii / connect.js
Last active May 2, 2019 01:41
Getting Started with Webtask.io for IoT
var connectCallback = function (err) {
if (err) {
logCommand('Could not connect: ' + err);
completed(log);
} else {
logCommand('Client connected');
@WilliamBerryiii
WilliamBerryiii / Instructions.md
Last active May 2, 2019 01:40
Using x509 Client Certificates with Azure IoT Protocol Gateway with Node

Instructions for local debug

  • Download and install the Azure Storage Emulator
  • Start the emulator from the Start Menu
  • Add 127.0.0.1 protocol-gateway.contoso.com to your windows hosts file: C:\Windows\System32\drivers\etc\hosts
  • git clone https://github.com/Azure/azure-iot-protocol-gateway
  • Right Click Visual Studio and select Run As Administrator
  • Open the Protocol Gateway Solution
  • Modify the VS Solution host\ProtocolGateway.Host.Console\appSettings.config.user file with your IoT Hub Connection String
  • Run the Solution
@WilliamBerryiii
WilliamBerryiii / query.sql
Last active January 4, 2017 23:24
Azure IoT Hub Modbus Demo
SELECT
Cast (DataTimestamp as datetime) as datetimestamp,
device_type,
(Cast(address_30002 AS float) / 65535 * 100) as cnt
INTO
[power-bi]
FROM
[iot-hub]
@WilliamBerryiii
WilliamBerryiii / build.ps1
Last active May 2, 2019 01:37
Build and Configure Modbus Sample for Azure Iot Gateway SDK
# load up the visucal c envirionment varaibles for use in the build, and call the SDKs build script
Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64_x86
.\tools\build.cmd --skip-unittests
# with the build complete, restore our environment variables
Restore-Environment $env
@WilliamBerryiii
WilliamBerryiii / ASA-query.sql
Last active November 29, 2016 00:29
FS Advent - Azure IoT
SELECT
location.Latitude,
location.Longitude,
windSpeed,
deviceId,
obsTime
INTO
[powerbi-out]
FROM
[decompshred-in]
@WilliamBerryiii
WilliamBerryiii / GZip.cs
Last active October 12, 2016 15:09
GZip Examples
public static IEnumerable<string> Compress(this IEnumerable<string> stream)
{
foreach (var message in stream)
{
// this string compression code is lifted & modified from
// http://madskristensen.net/post/Compress-and-decompress-strings-in-C
var buffer = Encoding.UTF8.GetBytes(message);
var ms = new MemoryStream();
using (var zip = new GZipStream(ms, CompressionMode.Compress, true))
{