Skip to content

Instantly share code, notes, and snippets.

Avatar

James Sutton jpwsutton

View GitHub Profile
@jpwsutton
jpwsutton / README.md
Created Dec 31, 2021
Headless d3-celstial
View README.md

Headless d3-celestial setup

This gist is a bit of a hack that lets you generate a d3-celestial svg without a web browser.

Requirements

git clone https://github.com/ofrohn/d3-celestial.git npm install jsdom

Finally, add a lib directory and download require.js into it from here: https://requirejs.org/docs/download.html

@jpwsutton
jpwsutton / audio_dub_sync.py
Created Feb 6, 2021
A very rough python script to synchronise dubbed audio from different videos.
View audio_dub_sync.py
#!/bin/python
"""
audio_dub_sync.py
This script will take a Pair of VCD video files as well as a High Quality Blu Ray Rip
and will syncronise the audio and add it as a new track.
"""
# Import Libraries
from pathlib import Path
@jpwsutton
jpwsutton / draggonEgg.py
Created Jan 1, 2019
Microbit Python Script to control a light up dragon egg
View draggonEgg.py
from microbit import *
from neopixel import NeoPixel
num_pixels = 47
purple = (64,0,64)
red = (255,0,0)
off = (0,0,0)
speed = 50 # in ms
steps = 20
currentColour = off
View wireClip.scad
$fn = 60;
//LED Dimensions
led_d=8; //LED Diameter
led_h=11; //LED Height
led_fh=2; //LED FLange Thickness
led_fd=9; //LED Flange Diameter
led_flt=4; // The length of the flat bit
// Wireclip module
@jpwsutton
jpwsutton / instax-flow.js
Last active May 30, 2018
Node-Red flow for controlling and connecting to a Fujifilm INSTAX Printer
View instax-flow.js
[
{
"id": "5e4a70ef.bac7a",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "17f15d16.6e3143",
@jpwsutton
jpwsutton / nr-mqttsn-bridge.json
Created Mar 25, 2018
Node-red-at-mqttsn-udb-bridge
View nr-mqttsn-bridge.json
[{"id":"305d953b.4abf6a","type":"tab","label":"Robot","disabled":true,"info":""},{"id":"910d848f.a215b8","type":"tab","label":"AT Commands","disabled":false,"info":""},{"id":"8a4dab5a.1db6c8","type":"tab","label":"Network","disabled":false,"info":""},{"id":"2cd98bfb.5a9a54","type":"mqtt-broker","z":"","broker":"jit4q3.messaging.internetofthings.ibmcloud.com","port":"1883","clientid":"d:jit4q3:GlowOrbControl:bce8-ff91","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"d4571afa.2a9fa8","type":"mqtt-broker","z":"","name":"Personal IoT","broker":"wdwf42.messaging.internetofthings.ibmcloud.com","port":"1883","clientid":"a:wdwf42:red","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"2f2480a5.7e57b","type":"ui_tab","z":"","name":
View cuckoo_clock.ino
/*
Muji Cuckoo Clock MQTT Controller V1.0
James Sutton - 2017
jsutton.co.uk
To trigger the cuckoo animation, publish an mqtt message with the payload of '1' to the topic
described in the settings below.
Use board "WeMos D1 R2 & mini"
CPU 160MHz
@jpwsutton
jpwsutton / eventbutton.ino
Created Oct 3, 2017
Event button alternate using HTTP
View eventbutton.ino
/*
Debounce
Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
press), the output pin is toggled from LOW to HIGH or HIGH to LOW. There's
a minimum delay between toggles to debounce the circuit (i.e. to ignore
noise).
The circuit:
* LED attached from pin 13 to ground
View glowOrb.ino
/*
Rehau VOC Glow Orb
Gas visual alert using a Rehau VOC, WeMoS D1 ESP-8266 board and IBM Bluemix Quickstart.
Expects to receive a number, in ASCII, over MQTT, which it compares to a threshold to decide whether
to display red or green. e.g. "400"
by Andy Stanford-Clark - with embellishments by Lucy Rogers
View MQTTWemosButton.ino
/***************************************************
MQTT Button on Wemos
James Sutton 2017 - jsutton.co.uk
****************************************************/
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
/************************* WiFi Access Point *********************************/