Skip to content

Instantly share code, notes, and snippets.

jamesbulpin / Program.cs
Created Mar 15, 2019
Quick test of a MQTT client to control PowerPoint slides
View Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MQTTnet;
using MQTTnet.Client;
using PPt = Microsoft.Office.Interop.PowerPoint;
using System.Runtime.InteropServices;
jamesbulpin /
Created Mar 13, 2019
Simple Python HTTP server that provides an API to turn Fitbit watch orientation data into commands to a pan-tilt unit
import SocketServer
import SimpleHTTPServer
import math
import json
import pantilthat
PORT = 9090
jamesbulpin /
Created Mar 13, 2019
Simple (and fairly crap) face tracker for Raspberry Pi with a pan-tilt hat.
import numpy as np
import cv2
import pantilthat
import picamera
faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
camera = picamera.PiCamera()
jamesbulpin / bauble.ino
Last active Dec 19, 2018
Sketch for the Christmas countdown bauble
View bauble.ino
// Christmas tree bauble countdown timer for ESP8266 with 128x32 OLED display
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include "SSD1306.h"
#include <ArduinoJson.h>
jamesbulpin / ws2811v2.js
Created Dec 10, 2018
#IoTree MQTT version
View ws2811v2.js
var ws281x = require('rpi-ws281x-native');
var tinycolor = require("tinycolor2");
var mqtt = require('mqtt');
var font5x7 = require('./font.js');
var fs = require('fs');
try {
var xy = require('./xy.json');
catch (ex) {
var xy = null;
jamesbulpin / skill.json
Created Nov 25, 2018
Alexa skill definition for Cambridge bin collection query
View skill.json
"interactionModel": {
"languageModel": {
"invocationName": "my house",
"intents": [
"name": "AMAZON.CancelIntent",
"samples": []
jamesbulpin /
Created Nov 25, 2018
Alexa skill handler for Cambridge bin collection query
# Set environment variable BIN_CALENDAR_URL to the specific ical calendar for your postcode
#<id> where <id> can be found
# interactively using
from urllib2 import urlopen
from datetime import datetime, timedelta
import os
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.dispatch_components import (
AbstractRequestHandler, AbstractExceptionHandler,
View package.json
"dependencies": {
"azure-iot-device-amqp": "^1.3.0",
"azure-iot-device-amqp-ws": "^1.0.16",
"request": "^2.83.0",
"serialport": "^6.0.4",
"tinycolor2": "^1.4.1",
"tempfile": "^2.0.0"
View piaudio.js
var DeviceClient = require('azure-iot-device').Client
var DeviceProtocol = require('azure-iot-device-amqp').AmqpWs;
var exec = require('child_process').exec;
var tempfile = require('tempfile');
var fs = require('fs');
var SerialPort = require("serialport");
var request = require('request');
var connectionString = "HostName=[...]";
var azureCognitiveServicesAuthEndpoint = '';
View azure-tts.js
var azureCognitiveServicesMainEndpoint = '';
function azureCallApi(text, callback) {
var ssml = "<speak version='1.0' xmlns=\"\" xml:lang='en-US'>" +
"<voice name='Microsoft Server Speech Text to Speech Voice (en-GB, George, Apollo)'>" +
"<prosody rate=\"slow\">" +
text +
"</prosody>" +
"</voice>" +