Skip to content

Instantly share code, notes, and snippets.

View LeoDJ's full-sized avatar

LeoDJ

View GitHub Profile
# 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 May 3, 2023 09:07
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 / _cm1106_co2_sensor_esphome.yaml
Last active November 24, 2022 01:01
ESPHome Custom Sensor CM1106 CO2
esphome:
name: cm1106_sensor
platform: ESP32
board: wemos_d1_mini32
includes:
- "cm1106.h"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pass
@LeoDJ
LeoDJ / userChrome.css
Last active October 21, 2022 07:19
TreeStyleTabs userChrome.css (hide tab bar and "Tree Style Tab" headline)
/* put file in <AppData>/Mozilla/Firefox/Profiles/<yourProfile>/chrome */
/* to correctly display tab title as window title, set browser.tabs.drawInTitlebar to false in about:config */
/* note: since FF 69 you also need to set toolkit.legacyUserProfileCustomizations.stylesheets to true for it to work*/
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar {
opacity: 0;
pointer-events: none;
}
#main-window:not([tabsintitlebar="true"]) #TabsToolbar {
visibility: collapse !important;
@LeoDJ
LeoDJ / T6
Last active June 5, 2022 17:19
ISDT Firmware Changelog (manually updated)
T6 V1.0.0.4
1. FD-100 DSC Voltage Seting Support.
2. Optimize BattGo handling at work.
T6 V1.0.0.16
1. Support for adjust the smart power voltage.
T6 V1.0.0.17
1.Increase agreement for SmartPower.
@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)
@LeoDJ
LeoDJ / xpv2bin.py
Created April 27, 2021 23:57
Convert XPV/XDV files to binary (CSR Blueflash Bluecore firmware files)
#!/usr/bin/env python3
# Convert XPV/XDV files to binary (CSR Blueflash / Bluecore firmware files)
# Quickly hacked together by LeoDJ
import sys
import os
def xpv2bin(input_file, output_file):
with open(input_file) as f_in, open(output_file, "wb") as f_out: