Skip to content

Instantly share code, notes, and snippets.


David Gray Grayda

View GitHub Profile
Grayda / index.php
Created March 26, 2019 04:14
Verify a Patreon webhook hash with PHP
View index.php
// This example can be copied and pasted into Laravel.
// If you're not using Laravel, change the $request related stuff into PHP's native stuff (e.g. file_get_contents("php:///input") etc.)
function verifyPatreonHash(Request $request) {
$patreonBody = $request->getContent(); // This is the raw **body** of the request, which will be JSON (but don't json_decode it!)
$patreonSignature = $request->header('X-Patreon-Signature'); // And this is the header from Patreon
$webhookSecret = "Patreon Webhook Secret Here"; // This'll be the secret Patreon gave you when you created the webhook
$webhookHash = hash_hmac('md5', $patreonBody, $webhookSecret); // This is the hash we've calculated, based on the body and the secret
Grayda / usbrelay.js
Last active July 12, 2018 01:11
Control 5v relay using node.js
View usbrelay.js
var HID = require('node-hid');
var _ = require("lodash")
var device
device = setup()
setInterval(function() {
console.log("Relay enabled? " + getState())
}, 1000)
Grayda / start_of_calendar.ics
Created October 10, 2017 04:29
Timezone demo
View start_of_calendar.ics
Grayda /
Last active June 11, 2019 13:23
Extract the Kepler key
# This downloads kepler.apk from and uses strings and grep with regex to find the line that contains the key.
echo Downloading the Kepler APK from
wget -qO /tmp/kepler.apk
echo Download complete. Extracting and searching for the key. The key should be displayed below.
unzip -p /tmp/kepler.apk classes.dex | strings | grep -e '^[A-Za-n1-9]\{16\}$'
Grayda / weather-icons.css
Created December 3, 2016 01:23 weathericon mappings
View weather-icons.css
* Weather Icons 2.0
* Updated August 1, 2015
* Weather themed icons for Bootstrap
* Author - Erik Flowers -
* Email:
* Twitter:
* ------------------------------------------------------------------------------
* Maintained at
Grayda / gulpfile.js
Created September 10, 2016 15:48
Gulpfile for effortlessly switching between paid and free building
View gulpfile.js
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var cp = require("child_process")
Grayda /
Last active June 11, 2019 13:20
Information about the Orvibo Kepler

These are some rough notes regarding the Orvibo Kepler

The Kepler uses a different protocol to the previous devices (S20, AllOne etc.), but once you get past the changes in protocol, the commands are very much the same.

The Kepler uses UDP on port 9999. The header of the packet is the same (e.g. 646400 ..., but the body is now encrypted JSON. The encryption is AES ECB and the decryption key is stored in the app. Simply decompile the app and look in com\orvibo\lib\kepler\core\ Use something like to quickly decrypt and check data. The start of the encrypted data is denoted by 0x09 and runs right to the end of the packet (?).

As mentioned above, the protocol is rather similar to the other devices. Here's a sample packet from the Kepler app, showing discovery:


Grayda / index.js
Created July 17, 2016 13:35
Move screenshots to folder based on size
View index.js
// Run `npm install --save image-size mv` to install mv (for easily moving files) and image-size (for determining image dimensions)
var fs = require("fs")
var mv = require("mv")
var sizeOf = require('image-size');
var dest = 'C:\\Users\\David\\Downloads' // The location of your downloads folder in Firefox.
// Watch the folder and report when an event has happened, (event, filename) => {
// Try block because I'm lazy. This did exactly what I needed.
Grayda / error codes
Last active August 29, 2015 14:21
Error codes from
View error codes
Extracted from using these Regexs:
progress "0040" "Writing partition table..."
progress "0043" "Partition table write was successful."
progress "0042" "Partition table update failed - $?."
progress "0044" "Probing '$drive' partition table..."
progress "0047" "Partition table probe of '$drive' completed successfully."
Grayda / main.go
Created May 13, 2015 04:09
main.go for Ninja Sphere driver
View main.go
package main
import (
func main() {