Skip to content

Instantly share code, notes, and snippets.

View mwvent's full-sized avatar

Matthew Watts mwvent

View GitHub Profile
@mwvent
mwvent / plotter.cfg
Created July 29, 2023 14:33
Klipper plotter LCD config and Macros
[gcode_macro PLOTTER_VARS]
variable_plotmode_on: 0
variable_xoffset: -5 ; distance from normal extruder on X axis
variable_yoffset: 18 ; distance from normal extruder on Y axis
variable_zoffset: 5
variable_zdown_offset: -1 ; match z distance gcode files use - for setup
variable_zup_offset: 10 ; distance from z home to lift
variable_zdeploy_offset: 30 ; distance from z for manual deploy
variable_plotting_mode: 0
gcode:
@mwvent
mwvent / picam.py
Last active February 10, 2022 00:57
PI Zero Bicycle Dashcam Python Service
#!/bin/python3
# Python script for using my Pi Zero as a Bicycle Dashcam which also live streams
# to an rtsp-simple-server running at home
# Recommended to start as a user systemd service
# This script requires user access to /sys/devices/platform/leds/leds /sys/class/leds
# Also recordings folder tends to corrupt very easily and should be its own filesystem
# I use NTFS to allow police/other windows 10 users to access recordings
# - DO NOT bother with vfat it is too unreliable
# I use the following commands in /etc/rc.local to prepare for running this script
@mwvent
mwvent / Record images and data from IP Webcam app - make timelapse plot data
Last active October 11, 2021 16:58
Data collection scripts for ******'s homework - record images and sensor data from android phone running "ip webcam" and create timelapse and data spreadsheet where phone IP address is 192.168.1.25
#!/bin/bash
# Name this file cleanspreadsheet.sh
# run as ./cleanspreadsheet.sh > data2.csv
echo "Mins Elapsed,DateTime,Temp C,Pressure mbar,Humidty %,BAT"
START_TIME="2021-10-10 17:51:24"
START_TIME_UNIXTIME="$(date -d "${START_TIME}" +%s)"
tail -n +2 data.csv | awk -F',' '{printf "%s %s,%.2f,%.2f,%.2f,%s\n",$1,$2,$3,$4,$5,$6}' | while read LN; do
LINE_TIME="$(echo $LN | cut -d ',' -f 1)"
LINE_TIME_UNIXTIME="$(date -d "${LINE_TIME}" +%s)"
@mwvent
mwvent / Google>Tasmota nodered function
Last active October 17, 2021 18:32
Tasmota Rules For Sonoff Mini Piggybacking a cheapie floodlight
codes = {
0xFF0000 : { "Event": "RED1", "IRSend": {"Protocol":"NEC","Bits":32,"Data":"0xF720DF","DataLSB":"0xEF04FB","Repeat":0} },
0x00FF00 : { "Event": "GRN1", "IRSend": {"Protocol":"NEC","Bits":32,"Data":"0xF7A05F","DataLSB":"0xEF05FA","Repeat":0} },
0x0000FF : { "Event": "BLU1", "IRSend": {"Protocol":"NEC","Bits":32,"Data":"0xF7609F","DataLSB":"0xEF06F9","Repeat":0} },
0xFFFFFF : { "Event": "WHT", "IRSend": {"Protocol":"NEC","Bits":32,"Data":"0xF7E01F","DataLSB":"0xEF07F8","Repeat":0} },
0xBFFF00 : { "Event": "GRN1", "IRSend": {"Protocol":"NEC","Bits":32,"Data":"0xF7A05F","DataLSB":"0xEF05FA","Repeat":0} },
0xFF9100 : { "Event": "ORG1", "IRSend": {"Protocol":"NEC","Bits":32,"Data":"0xF708F7","DataLSB":"0xEF10EF","Repeat":0} },
0xAD670A : { "Event": "ORG2", "IRSend": {"Protocol":"NEC","Bits":32,"Data":"0xF730CF","DataLSB":"0xEF0CF3","Repeat":0} },
0x88EBE4 : { "Event": "CYA1", "IRSend": {"Protocol":"NEC","Bits":32,"Data":"0xF7B04F","DataLSB":"0xEF0DF2","Repeat":0} },
0x
@mwvent
mwvent / deps
Created April 10, 2020 21:31
Play Top Zoneminder Recordings as a loopback video device
future==0.18.2
mysql-connector==2.2.9
pkg-resources==0.0.0
@mwvent
mwvent / example hook script
Created February 20, 2020 17:26
LAN home events - sending and listenting for UDP broadcasts
# Example broadcast command triggered in my case by the RPi doorbell
echo "doorbell" | socat - UDP-DATAGRAM:255.255.255.255:12345,broadcast
@mwvent
mwvent / README.txt
Last active September 23, 2021 15:57
Zoneminder Record High-res H264 streams 24/7 with low CPU Load
>>>>>>>>>>>>>>>>>>>>> BIG UPDATE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
On zoneminder version 1.35.16 and later there is a DecodingEnabled setting for each monitor - this script is therefore of little use anymore
>>>>>>>>>>>>>>>>>>>>> ORIGINAL README <<<<<<<<<<<<<<<<<<<<<<<<<<<<
The original Zoneminder Forum thread about all this is here:
https://forums.zoneminder.com/viewtopic.php?f=9&t=27537&p=107235#p107235
@mwvent
mwvent / cam_alarmserver_zm_bridge.sh
Last active March 13, 2020 02:33
Receive motion events from Xiongmai/Netsurv web camera and pass to Zoneminders trigger port eliminating need for image analysis on ZM Server
#!/bin/bash
# Function to translate camera serial into zoneminder monitor id
function serialToID() {
MONITORID=0
if [ "$1" == '"383c49531157b1b1"' ]; then
MONITORID=9
fi
echo $MONITORID
}
# Netcat persistent listen
@mwvent
mwvent / RCSwitch.cpp
Created June 19, 2019 00:06
My mod of RCSwitch.cpp from the RCSwitch Arduino Lib to spit out my doorbell and other random stuff as protocol 7
/*
RCSwitch - Arduino libary for remote control outlet switches
Copyright (c) 2011 Suat Özgür. All right reserved.
Contributors:
- Andre Koehler / info(at)tomate-online(dot)de
- Gordeev Andrey Vladimirovich / gordeev(at)openpyro(dot)com
- Skineffect / http://forum.ardumote.com/viewtopic.php?f=2&t=46
- Dominik Fischer / dom_fischer(at)web(dot)de
- Frank Oltmanns / <first name>.<last name>(at)gmail(dot)com
@mwvent
mwvent / bluetoothbulb_connector.service
Created January 30, 2019 14:49
Bluetooth Speaker Auto connect service - for running in BG when autologging in on Kodi, replace USERGID and USERNAME with autologin user
#/etc/systemd/system/bluetoothbulb_connector.service
[Unit]
Description=BluetoothBulbConnector
After=network.target
[Path]
PathExists=/run/user/1000
[Install]
WantedBy=multi-user.target