Skip to content

Instantly share code, notes, and snippets.

View jaydlawrence's full-sized avatar

Jayd Lawrence jaydlawrence

View GitHub Profile
@jaydlawrence
jaydlawrence / README.md
Created December 4, 2018 20:01
Web site monitor - change notifications

Web site monitor - change notifications

A simple script to check a website for a particular string and notify if the occurances change.

Notify via pushover.net notification service, osascript and say

This was set up as a cron to check every 10 minutes.

*/10 * * * * /usr/bin/env bash /path/to/script/check.sh
@jaydlawrence
jaydlawrence / recursiveArrayFlatten.html
Last active March 29, 2018 15:11
A quick test to get a recursive array flatten function in JS.
<script type="text/javascript">
const processString = () => {
try {
const arrayString = document.forms["myForm"]["array"].value;
const jsonDecodedArray = JSON.parse(arrayString);
const resultArray = arrayFlatten(jsonDecodedArray);
const resultArrayString = JSON.stringify(resultArray);
document.getElementById("result").innerHTML = `Result: ${resultArrayString}`;
}
catch(error) {
@jaydlawrence
jaydlawrence / keybase.md
Created November 6, 2017 15:47
public key for keybase

Keybase proof

I hereby claim:

  • I am jaydlawrence on github.
  • I am jaydlawrence (https://keybase.io/jaydlawrence) on keybase.
  • I have a public key ASDSi7IhBEtn6_Amc3e_SVtoWqAnMGpf_KvC5I42BbhshQo

To claim this, I am signing this object:

@jaydlawrence
jaydlawrence / temp-humidity-broadcast.ino
Created September 18, 2017 12:12
Particle Photon and DHT11 - Publish temperature and humidity data
// requires the DHT11 arduino library - https://playground.arduino.cc/Main/DHT11Lib
#include "dht11.h"
#include "Particle.h"
dht11 DHT11;
// pin 2 is used as the data pin to communicate with the DHT11 board
#define DHT11PIN 2
// how long between measurements
@jaydlawrence
jaydlawrence / Arduino_ESC_controller_with_pot.ino
Created August 24, 2017 21:40
An Arduino sketch to control an ESC via PWM, including initial handshake and reading input from a potentiometer to modulate the speed.
#include <Servo.h>
// create motor handler of the Servo class type
Servo motor;
// The On/Off button will be on pin 6
const int buttonPin = 6;
// The Potentiometer to adjust speed will be on pin 7
const int potPin = 7;
// Motor signal is on pin 3
const int motorPin = 3;
@jaydlawrence
jaydlawrence / check_hashrate_reboot.py
Last active June 28, 2019 21:28
Script to check the hashrate of ethereum worker on ethOs and reboot if the hashrate is 0 for 2 runs of this script. This script is for a single GPU, or rather it will only reboot if the overall hashrate reaches 0. It also uses the pushover service to push notifications for when the script triggers a reboot.
import subprocess
import os
import re
import sys
import argparse
import httplib, urllib
import time
"""
# place this file at /home/ethos/check_hash_reboot.py
@jaydlawrence
jaydlawrence / camera_mount_v1
Created March 31, 2016 20:27
ZMR250 Camera Mount in OpenSCAD
$fn = 100;
distanceBetweenPoleCentres = 31.5;
poleRadius = 2.7;
thickness = 2;
outerRadius = poleRadius + thickness;
distanceBetweenPoles = distanceBetweenPoleCentres - (2*outerRadius);
poleHeight = 34.8;
cameraDepth = 22;
bottomPlateThickness = thickness;
bottomPlateWidth = cameraDepth;
@jaydlawrence
jaydlawrence / ZMR250 OpenSCAD Naze32 Rev6 spacer design
Created January 3, 2016 22:10
OpenSCAD functions to customise ZMR250 frame spacer for Naze32 rev6 board
$fn=100;
//source for original frame http://www.thingiverse.com/download:1477363
//shorten the height to 12mm
module shortened() {
difference() {
translate([0,0,12]){
difference() {
rotate([-90,0,0]) {
@jaydlawrence
jaydlawrence / nexus_check.php
Last active August 29, 2015 14:11
A short PHP script to notify me via PushBullet when the Nexus 6 64GB White becomes available for sale on the UK Google Play store
#!/usr/bin/php
<?php
$url = "https://play.google.com/store/devices/details/Nexus_6_64_GB_Cloud_White?id=nexus_6_white_64gb";
//$url = "https://play.google.com/store/devices/details/Nexus_6_64_GB_Midnight_Blue?id=nexus_6_blue_64gb";
//$url = "https://play.google.com/store/devices/details/Nexus_6_32_GB_Midnight_Blue?id=nexus_6_blue_32gb";
$opts = array('http' =>
array(
'method' => 'GET',
'header' => array(
"authority:play.google.com",