Skip to content

Instantly share code, notes, and snippets.

View LeoDJ's full-sized avatar

LeoDJ

View GitHub Profile
@LeoDJ
LeoDJ / footprint_path_placer.py
Last active February 17, 2026 22:11
KiCad 9 script to duplicate and arrange footprints along a drawing line / path
#!/usr/bin/env python3
"""
KiCad 9 PCBnew Script: Duplicate Footprint Along a Drawing Path
Author: LeoDJ
Disclaimer: Dirtily hacked together and partly vibe coded.
I've tried to use the attached prompt, but the result was shit, I had to fix many logic mistakes / API hallucinations. Probably would've been faster to actually write it completely myself.
Usage:
- Save this script as footprint_path_placer.py besides the .kicad_pro file
@LeoDJ
LeoDJ / README.md
Created July 11, 2025 14:34
Bambulab X1 Carbon Filament Sensor Hall Effect Sensor Pinout

Bambulab X1 Carbon Filament Sensor Hall Effect Sensor Pinout

  1. Vcc (White cable)
  2. Signal from cutter hall effect sensor
  3. Signal from filament detection hall effect sensor
  4. GND
  5. NTC (15k?)
@LeoDJ
LeoDJ / carmin_crypto.py
Created April 15, 2025 22:52
Some reverse engineering of the Carmin Android app backend
# pip3 install pycryptodome
# Encryption for the "http://carmin-backend.appspot.com/rs" URL paths
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
class CarminURLEncryptor:
def __init__(self):
@LeoDJ
LeoDJ / ModernStandbyWorkaround_Task.xml
Last active November 12, 2025 09:22
Workaround for Windows Modern Standby waking up all the damn time by simply putting it back to sleep if it wakes up for the wrong reason
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2024-05-13T03:03:36.8710082</Date>
<Author>LEO-FW16\LeoDJ</Author>
<URI>\ModernStandbyWorkaround</URI>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
# ESPHome Configuration for Tuya Smart Life RGBW Controller (AP-Future) by LeoDJ
# https://s.click.aliexpress.com/e/_De97s2j
# Implemented using ESPHome package feature, for semi-easy configuration of multiple devices
packages:
common: !include common/tuya-ap-future-rgbw.yaml
substitutions:
node_name: "rgbw-example-device"
node_friendly_name: "RGBW Example Device"
api_key: !secret generic_api_key
@LeoDJ
LeoDJ / drawer_control_SP-850.py
Created July 16, 2023 19:17
Python script to control/open a Partner Tech SP-850 cash drawer
# Control a Partner Tech SP-850 cash drawer
# Needs root
import portio
import time
# request permission to I/O port range
portio.ioperm(0x5a8, 4, 1)
# Has to be 32bit access, otherwise the EC won't respond
@LeoDJ
LeoDJ / README.md
Last active January 30, 2025 00:00
Opening .pl Interleaf WorldView PrinterLeaf files (and converting them to .pdf)

This is more of a note to myself / a try to give the problem a bit more SEO visibility, so please excuse the probably weird writing style and structure.

tl;dr at the bottom

  • .PL extension is for "PrinterLeaf" files
    • They start with the magic bytes D0 4F 50 53 (ÐOPS)
    • Commonly contain header strings like:
      For: / Printed on: / From book: / Document: / Last saved on:
      Name: / Ausgedruckt: / Aus dem Buch: / Dokument: / Zuletzt gespeichert:
  • And for my test file they contained references to font files like:
@LeoDJ
LeoDJ / ha_volume_helper_scripts.yaml
Created May 3, 2022 22:40
HomeAssistant helper scripts for controlling volume of media_player entities
volume_down:
alias: Volume Down
description: Volume Down with user defined step size
fields:
entity_id:
selector:
entity:
domain: media_player
step:
default: 0.05
@LeoDJ
LeoDJ / printHexdump.c
Last active May 1, 2022 22:33
Print hexdump of a buffer. Quickly hacked together but works.
// Quick way to print a hexdump of a buffer. Output will look like this:
//
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
// 0000 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 68 This is a test h
// 0010 65 78 64 75 6D 70 21 20 46 6F 6F 2E 20 01 02 03 exdump! Foo. ...
// 0020 04 .
inline void printHexdumpAscii(uint16_t index, uint8_t byte) {
if (index % 16 == 8) { // some spacing for orientation
printf(" ");
@LeoDJ
LeoDJ / ttn_mapper_uplink_payload_formatter.js
Created March 10, 2022 23:18
Uplink Payload Formatter for TTN Mapper LoRa node (including generic function for converting raw C struct integer values to JavaScript number)