Skip to content

Instantly share code, notes, and snippets.

View LeoDJ's full-sized avatar


View GitHub Profile
Mezgrman /
Last active June 30, 2023 14:09
Bash script to append aliases to peer IDs in Wireguard output
# To the extent possible under law, I hereby waive all copyright
# and related or neighboring rights to this program.
# Determine the path of this script, to read the aliases file relative to that
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
# Check if the unbuffer command is available.
# It is used to retain colored output from wg show
darkxst / rules.txt
Last active February 28, 2024 03:54 — forked from denniskupec/rules.txt
KiCad DRC rules for JLCPCB, 2 & 4-layer PCB
View rules.txt
(version 1)
#Kicad 7
# 2-layer, 1oz copper
(rule "Minimum Trace Width (outer layer)"
(constraint track_width (min 5mil))
(layer outer)
(condition "A.Type == 'track'"))
(rule "Minimum Trace Spacing (outer layer)"
patagonaa /
Last active February 6, 2024 14:30
Extract Gyro / Accelerometer Data from Samsung Gear 360 2017 (SM-R210) MP4 files
#!/usr/bin/env python3
import io
import logging
import os
import struct
import sys
import csv
from typing import BinaryIO
import matplotlib.pyplot as plt
BenWoodford /
Last active October 17, 2023 02:33
Lighthouse 2.0 GATT Information

All control characteristics are under Service 00001523-1212-EFDE-1523-785FEABCD124


Mode = 00001524-1212-EFDE-1523-785FEABCD124 (READ, WRITE, NOTIFY)

Identify = 00008421-1212-EFDE-1523-785FEABCD124 (WRITE)

Power State = 00001525-1212-EFDE-1523-785FEABCD124 (WRITE, newer firmware also had READ and NOTIFY)

jackm /
Last active February 21, 2024 08:33
Collection of CAN bus packages and tools

Collection of CAN bus packages and tools

This document assumes the use of Linux as the chosen development platform. Items in bold are highly recommended.

It is recommended to use SocketCAN when working with CAN bus on Linux. It is supported by the Linux kernel mainline and follows the Linux interface model, allowing you to use other network tools such as Wireshark. This also allows the creation of virtual CAN interfaces where no physical hardware is required to simulate or replay CAN messages.

totti2 /
Last active July 27, 2023 08:41
Synchronous multi-room sound casting of Bluetooth, Airplay, Line-In and Spotitfy

Synchronous multi-room sound casting of Bluetooth, Airplay, Line-In and Spotitfy

ALL CREDITS TO @badaix AND @BaReinhard

This will setup a raspberry-pi-3 as a snapcast-server and snapcast-client.
Possible music sources for the snapserver-component: Bluetooth, Airplay, Spotify, Line-In (more to come eg. RTP)
Music sinks (snapclients): usb soundcard connected to my stereo, another Pi

To Do:

  • Energy saving by disabling onboard bluetooth, wifi and soundcard
bbx10 / ESPWebSock.ino
Last active March 3, 2023 22:13
ESP8266 Web server with Web Socket to control an LED
View ESPWebSock.ino
* ESP8266 Web server with Web Socket to control an LED.
* The web server keeps all clients' LED status up to date and any client may
* turn the LED on or off.
* For example, clientA connects and turns the LED on. This changes the word
* "LED" on the web page to the color red. When clientB connects, the word
* "LED" will be red since the server knows the LED is on. When clientB turns
* the LED off, the word LED changes color to black on clientA and clientB web
jblang /
Last active January 25, 2024 17:00
TPM2 Protocol Description

TPM2 Protocol Implementation


Frame data is transferred inside packets (similar to DMX, for example). A frame is an image representing a matrix or a light scene.

The packets start and end with one-byte characters. In between are a few control bytes followed by the payload. There is no set size for a payload; it is transmitted with each packet. This makes the protocol quite flexible. There are enough bytes in a single packet for an RGB matrix with 21,845 pixels, but if you just want to control an RGBW lamp, that only requires 9 bytes. The variable frame size means there is no overhead, allowing for maximum transfer speed.

TPM2 Packet Structure