Skip to content

Instantly share code, notes, and snippets.

View jpwsutton's full-sized avatar

James Sutton jpwsutton

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jpwsutton on github.
  • I am jsutton (https://keybase.io/jsutton) on keybase.
  • I have a public key ASDkSwirSkrdxpkIDRbs7euFgnNf0q96P6m-aACVdUilBgo

To claim this, I am signing this object:

@jpwsutton
jpwsutton / audio_dub_sync.py
Created February 6, 2021 22:41
A very rough python script to synchronise dubbed audio from different videos.
#!/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 / README.md
Created December 31, 2021 16:07
Headless d3-celstial

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

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPfcQzU14UpKDJGEvr9cK3+DB/I48plbMCoI3FIX9UxW028Po9bQE7OcYNXp76px0m7NYvqHOnj8xKS4oJes+Q/8cQvbnbge46NwCj8wSCQZmysGLZk9g6AtCkCWXII+WW24oZspxXaNc0qMogtAx8izycMnYjZwQlkS9MzPMgLGT0giyqem9MRiu8XoqVc0/EteonzDCKw2CV1mNWKkjzw1AgTaIrM8zR1kdqMQkQO+8BL298zBcoUvPpyiHSBQrWPbq6nhqVedbFS3JNBsx+CiBjWttP2Px4ATyut1j7iQ//dBPZkt0TYmxMlGm6IZL18qxNh71gyZnyZGgwtO8K7TWbksDZL+WHI5vX69BUNvFsqwjwDEOJJJ0b6zIMgp4uzT0MdJoXcRHtzuq6VlrE36yjZpnx+dCzhtxZHFT8fFGr9O2QhxAVeTVOESVqc6LEIyP4qE+JdCXsY3I2YfUJPdgEV0LejeZPKmFsXDVQvuYRP/0Uej9MQDT+9j8sMxM= jamessutton@Jamess-MacBook-Pro.local
@jpwsutton
jpwsutton / example.html
Created November 30, 2016 11:45
Paho Javascript new Publish Example
<html>
<head>
<title>Eclipse Paho MQTT JavaScript Client Example</title>
<!-- Source Paho MQTT Client-->
<script src="../src/paho-mqtt.js"></script>
<!--<script src="../src/paho-mqtt.js"></script>-->
<!-- Utility Javascript -->
<script src="example.js"></script>
@jpwsutton
jpwsutton / MQTTWemosButton.ino
Created June 4, 2017 13:44
MQTT Wemos Button
/***************************************************
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 *********************************/
@jpwsutton
jpwsutton / printByteArray.java
Created November 17, 2016 11:15
Prints a byte array in binary, hex and dec.
private void printByteArray(byte[] bytes){
for (byte b1 : bytes){
String s1 = String.format("%8s", Integer.toBinaryString(b1 & 0xFF)).replace(' ', '0');
s1 += " " + Integer.toHexString(b1);
s1 += " " + b1;
System.out.println(s1);
}
}
/*
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 / draggonEgg.py
Created January 1, 2019 17:57
Microbit Python Script to control a light up dragon egg
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
@jpwsutton
jpwsutton / wireClip.scad
Last active November 28, 2018 21:14
WireClip
$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