Skip to content

Instantly share code, notes, and snippets.

Avatar

Zane Claes zaneclaes

View GitHub Profile
View M2 DUE Default GRBL Settings
client> $$
$0=10 (Step pulse time, microseconds)
$1=25 (Step idle delay, milliseconds)
$2=0$3=0 (Step pulse invert, mask)
$4=0 (Invert step enable pin, boolean)
$5=0 (Invert limit pins, boolean)
$6=0 (Invert probe pin, boolean)
$10=1 (Status report options, mask)
$11=0.010 (Junction deviation, millimeters)
$12=0.002 (Arc tolerance, millimeters)
@zaneclaes
zaneclaes / maslow-clamping-skirt.nc
Created Aug 3, 2020
gcode for the Maslow Clamping Skirt frame plans
View maslow-clamping-skirt.nc
(1001)
(T1 D=0.25 CR=0 - ZMIN=-0.8394 - FLAT END MILL)
G0 G40 G90 G17
G20
(POCKET ROUGH)
T1 M6
M3 S10000
G0 X12.3576 Y18.4
G0 Z0.2
@zaneclaes
zaneclaes / update-route53.py
Created Mar 18, 2020
Update route53 via AWS CLI with the current IP address. Usage: "update-route53.py subdomain1 subdomain2 domain-name.com"
View update-route53.py
#!/usr/bin/env python3
import subprocess, re, os, json, sys
zones = None
def _sh(cmd):
return subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True).stdout.strip()
def _whatsmyip():
return _sh('dig +short myip.opendns.com @resolver1.opendns.com')
@zaneclaes
zaneclaes / prometheus-to-mqtt
Created Feb 3, 2020
Node Red Forward Prometheus to MQTT
View prometheus-to-mqtt
[{"id":"d647cda7.47601","type":"tab","label":"OBD","disabled":false,"info":""},{"id":"c1814e23.3d93d","type":"inject","z":"d647cda7.47601","name":"","topic":"","payload":"","payloadType":"date","repeat":"15","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":240,"wires":[["e8d485cc.aa10a8"]]},{"id":"e8d485cc.aa10a8","type":"http request","z":"d647cda7.47601","name":"prometheus","method":"GET","ret":"txt","paytoqs":false,"url":"localhost:8000","tls":"","proxy":"","authType":"","x":290,"y":240,"wires":[["1360a3fe.df2cdc"]]},{"id":"1360a3fe.df2cdc","type":"function","z":"d647cda7.47601","name":"stats","func":"lines = msg.payload.split(\"\\n\");\nmsg.payload = [];\nfor(var i=0; i<lines.length; i++) {\n if (lines[i][0] == '#')\n continue;\n if (!lines[i].startsWith('obd_'))\n continue;\n var br = lines[i].indexOf('{');\n var sp = lines[i].indexOf(' ');\n var f = (br > 0 && br < sp) ? br : sp;\n var v = parseFloat(lines[i].substr(f+1))\n msg.payload.push([lines[i].substr(0, f),
@zaneclaes
zaneclaes / wifi-auto-connect.sh
Created Oct 30, 2019
Bash script to automatically connect to open WiFi networks, upon disconnect, via nmcli
View wifi-auto-connect.sh
#!/bin/bash
con="${1}"
if [[ -z "$con" ]]; then
echo "Please provide an interface name as an argument."
exit 1
fi
while true; do
conns=$(nmcli con show "$con" | grep "GENERAL.STATE:" | grep "activated")
View bridge-interface-hotswap-detect.sh
#!/bin/bash
interfaces=(eth0 eth1 eth2) # which interfaces to auto-detect, in descending order of priority
interface="eth0" # the default/current interface
while true; do
newif="$interface"
for i in "${interfaces[@]}"; do
if $(ip link show dev "$i"); then
newif="$i"
fi
View home-assistant-kiosk.js
if (window.location.href.indexOf('kiosk') > 0) {
setTimeout(function () {
try {
const home_assistant_main = document
.querySelector("body > home-assistant").shadowRoot
.querySelector("home-assistant-main");
const header = home_assistant_main.shadowRoot
.querySelector("app-drawer-layout > partial-panel-resolver > ha-panel-lovelace").shadowRoot
.querySelector("hui-root").shadowRoot
@zaneclaes
zaneclaes / spellbook-startup.sh
Last active Nov 24, 2019
Startup script for magic spellbook home automation with a Raspberry Pi kiosk and home-assistant.io
View spellbook-startup.sh
#!/bin/bash
#
# ARG_POSITIONAL_SINGLE([home-assistant-address],[root URL of home assistant])
# ARG_OPTIONAL_BOOLEAN([tvservice],[],[tvservice on],[on])
# ARG_OPTIONAL_BOOLEAN([usb],[],[USB on],[on])
# ARGBASH_GO()
# needed because of Argbash --> m4_ignore([
### START OF CODE GENERATED BY Argbash v2.8.1 one line above ###
# Argbash is a bash code generator used to get arguments parsing right.
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
@zaneclaes
zaneclaes / multipress-deployment.yml
Last active Jul 17, 2019
Sample kubernetes deployment of multipress: multiple wordpress sites with nginx in a single docker container
View multipress-deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: multipress
labels:
app: multipress
spec:
replicas: 2
selector:
matchLabels:
@zaneclaes
zaneclaes / switchboard-k8s-deployment.yaml
Last active Jul 17, 2019
A simple version of a Switchboard deployment via k8s
View switchboard-k8s-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: switchboard
labels:
app: switchboard
spec:
replicas: 2
minReadySeconds: 5
selector:
You can’t perform that action at this time.