Skip to content

Instantly share code, notes, and snippets.

View crossan007's full-sized avatar

Charles Crossan crossan007

View GitHub Profile
<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
@crossan007
crossan007 / showProps.js
Created November 5, 2021 15:25
Render JavaScript object to a string; include all properties and sub-objects.
function showProps(obj, objName) {
var result = ``;
for (var i in obj) {
// obj.hasOwnProperty() is used to filter out properties from the object's prototype chain
if (obj.hasOwnProperty(i)) {
if (typeof obj[i] != "object"){
result += `${objName}.${i} = ${obj[i]}\n`;
}
else {
result += `${objName}.${i} = ${showProps(obj[i],objName+"."+i)}\n`;
@crossan007
crossan007 / end.gcode
Created May 9, 2021 20:21 — forked from faparicior/end.gcode
Start and End G-code for Ender 3 on Cura
; Ender 3 Custom End G-code
G4 ; Wait
M220 S100 ; Reset Speed factor override percentage to default (100%)
M221 S100 ; Reset Extrude factor override percentage to default (100%)
G91 ; Set coordinates to relative
G1 F1800 E-3 ; Retract filament 3 mm to prevent oozing
G1 F3000 Z20 ; Move Z Axis up 20 mm to allow filament ooze freely
G90 ; Set coordinates to absolute
G1 X0 Y{machine_depth} F1000 ; Move Heat Bed to the front for easy print removal
M106 S0 ; Turn off cooling fan