Skip to content

Instantly share code, notes, and snippets.

View crossan007's full-sized avatar

Charles Crossan crossan007

View GitHub Profile
#!/usr/bin/env python3
import serial
import glob
import os
import time
import re
LOGFILE = "/var/log/printer_mapping.log"
PRINTER_DIR = "/dev/printers"
@crossan007
crossan007 / Scratchpad.md
Last active December 14, 2024 02:01
Overpass Turbo Examples / Scratchpad

Live Query App:

https://overpass-turbo.eu/#

Strategies

Identification

  1. Look for "invisible text" (adjust brightness / contrast / colors / levels / threshold / curves)

Searching

  1. Look for groups of businesses
  2. sometimes gas stations can change names, so use ["amenity"="fuel"]
<xml>
<test></test>
</xml>
@crossan007
crossan007 / oreo_watch.yaml
Created June 1, 2022 15:23
oreo_watch.yaml
substitutions:
devicename: clock
upper_devicename: clock
time:
- platform: homeassistant
id: esptime
sensor:
- platform: homeassistant
# https://www.instructables.com/H-Bridge-Motor-Driver-for-Arduino-Using-Transistor/
# https://www.modularcircuits.com/blog/articles/h-bridge-secrets/h-bridges-the-basics/
substitutions:
devicename: water_dispenser
upper_devicename: water dispenser
globals:
@crossan007
crossan007 / Tasmota Auto-Off Timer
Created March 14, 2022 14:13
Tasmota Auto-Off Timer
Uses actual Power state instead of button press so that it works from remote HomeAssistant commands
as well as local commands
Rule1
ON Power1#state=1 DO RuleTimer1 3600 ENDON
ON Rules#Timer=1 DO Power1 off ENDON
@crossan007
crossan007 / recycle-usb.sh
Created February 17, 2022 22:35
Recycle the power on USB ports of a Raspberry Pi
#!/bin/bash
# from https://raspberrypi.stackexchange.com/questions/5407/how-can-i-cut-power-coming-out-of-the-pis-usb-ports
sudo uhubctl -l 2 -a 2
<smil>
</smil>
@crossan007
crossan007 / stringToColor.ts
Created December 22, 2021 18:13
Create Color from a String
/**
* Renders an idempotent-ly random color hex code based on the input string
* @param str
* @returns
*/
stringToColor(str: string): string {
/**
* will end up as a 3-byte "char" array
*/
var hex: number[] = [];
@crossan007
crossan007 / camera.yaml
Created November 25, 2021 22:55 — forked from mbernson/camera.yaml
esphome configuration for the TTGO T-Camera ESP32-WROVER-B
# esphome configuration for the TTGO T-Camera ESP32-WROVER-B
# https://www.aliexpress.com/item/TTGO-T-Camera-ESP32-WROVER-B-PSRAM-Camera-Module-ESP32-WROVER-OV2640-Camera-Module-0-96/32966036489.html
# I use this 3D-printed case for the device:
# https://www.thingiverse.com/thing:3540059
esphome:
name: woonkamer
platform: ESP32
board: esp32dev