Skip to content

Instantly share code, notes, and snippets.

@y8s
y8s / mysensorsdecoder.js
Created April 9, 2019 14:55
Node-RED MySensors Payload Decoder Function
/* MySensors v2.3 Message Decoder
* Payload : JSON object
* Original author: www.projetsdiy.fr - oct. 2016
* Updated April 2019 by y8s
* Changes: Includes support for MySensors 2.3 Serial Protocol
* Returns (roughly) appropriate data types for each Set value (Integer, Float, String)
*/
var mySensorsMessage = {};
var newPayload = {};
var message = msg.payload.toString();
@y8s
y8s / 85-my-usb-audio.rules
Last active February 5, 2022 22:28
example camilladsp config for pi zero with two usb sound cards using alsa multi
#The UGreen 80864 usb dongle uses the 32bit/384khz capable ALC4030
#but changes product id depending on whats in the jack.
#this helps keep that name consistent. Future version may use serial number.
SUBSYSTEM!="sound", GOTO="my_usb_audio_end"
ACTION!="add", GOTO="my_usb_audio_end"
DEVPATH=="/devices/platform/soc/20980000.usb/usb1/1-1/1-1.1/1-1.1:1.0/sound/card?", ATTR{id}="Ugreen_CM"
@y8s
y8s / pihole-timeout.sh
Last active September 11, 2024 16:20
pihole-timeout.sh
#!/bin/bash
# Simple script to change admin login timeout in pihole version 5.17 and up.
# Note that some versions of pihole used 'loginpage.php' instead of 'login.php'
# make the script executeable by typing:
# chmod +x pihole-timeout.sh
# run it by typing:
# sudo ./pihole-timeout.sh
# Check if user is using sudo or is root:
if [[ $(/usr/bin/id -u) -ne 0 ]]; then