Skip to content

Instantly share code, notes, and snippets.

View tedivm's full-sized avatar

Robert Hafner tedivm

View GitHub Profile
@tedivm
tedivm / iterm2.txt
Last active May 24, 2025 19:17
Prompts
Return commands suitable for copy/pasting into \(shell) on \(uname), favoring descriptive flags and options over single letter ones when both are available.
For commands longer than 50 characters use escaped newlines and indentation to present the command in a readable way that can still be directly run in a terminal.
Do NOT include commentary NOR Markdown triple-backtick code blocks as your whole response will be copied into my terminal automatically.
Unless specifically told otherwise these commands will always be run inline. They should not have a shebang, and should not leave any variables in state after running unless asked to.
If you are unsure that something is possible say so. Do not make up flags, options, or arguments.
@tedivm
tedivm / esphome.yaml
Last active May 25, 2025 17:49
ESPHome ESP32-S3-Box-3 with Dock Voice Assistant
substitutions:
name: esp32-s3-box-3-99f810
friendly_name: ESP32 S3 Box 3 Office
micro_wake_word_model: hey_jarvis
packages:
esphome.voice-assistant: github://esphome/wake-word-voice-assistants/esp32-s3-box-3/esp32-s3-box-3.yaml@main
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
@tedivm
tedivm / github_backup.sh
Last active November 24, 2024 05:19
Github Backups
#!/usr/bin/env bash
ORGANIZATIONS="tedivm tedious multi-py TerraformInDepth GitConsensus"
BACKUP_DIR="/storage-pool/github"
FLAGS="--source --no-archived"
GITHUB_PREFIX="https://github.com/"
# GITHUB_PREFIX="[email protected]:"
function repo_list() {
@tedivm
tedivm / module_version.tf
Created April 23, 2024 19:16
Terraform Module Version from Inside Module
locals {
# Load the module versions from the modules.json file.
module_versions = jsondecode(file("${path.root}/.terraform/modules/modules.json"))
# Convert the module versions data into an object,
# with the module source path as key and version as value.
modules_by_source = { for module in local.module_versions :
module["Source"] => try(module["Version"], null)
}
@tedivm
tedivm / makefile
Created April 11, 2024 21:00
Rob's Mermaid and Dot Diagrams Makefile
# Configuration
MAKEFLAGS += -j8
DOT_OPTIONS:=-Nfontname=arial -Efontname=arial -Gfontname=arial
MMD_OPTIONS:=-w 2000 -b transparent --cssFile ./mermaid_png.css --configFile ./mermaid_config.json
# Get all diagram files
MERMAID_FILES:=$(shell find . -name "*.mmd" -type f -not -path '*/build/*')
DOT_FILES:=$(shell find . -name "*.dot" -type f -not -path '*/build/*')
# Files that should be generated
@tedivm
tedivm / robs_dimmer_blueprint.yaml
Created October 16, 2023 02:50
Home Assistant Dimmer Switch Blueprint
blueprint:
domain: automation
name: Rob's Dimmer Blueprint
description: Dimmer Controls
input:
controller_entity:
name: Philips Hue v2 Smart Dimmer Switch and Remote
description: The action sensor of the dimmer to use for the automation.
selector:
entity:
@tedivm
tedivm / plan.json
Created April 13, 2022 20:22
Terraform Plan Example
{
"format_version": "1.0",
"terraform_version": "1.1.7",
"planned_values": {
"root_module": {
"resources": [
{
"address": "random_integer.network",
"mode": "managed",
"type": "random_integer",
Twitter ID Screen name Followers Removal observed Before After
17461978 SHAQ 15612791 2022-02-26T22:24:52Z SHAQ.ETH SHAQ.SOL
21910850 jakeowen 2119904 2022-02-26T15:45:18Z jakeowen.eth Jake Owen
7846 ijustine 1811449 2022-03-09T14:43:37Z iJustine.eth iJustineUltra
1666038950 BoredElonMusk 1752290 2022-02-17T08:05:47Z bored.eth Bored
381051960 ethRuby 1267133 2022-03-19T08:08:11Z CryptoSolis.eth Ruby
1282418324228337665 wsbmod 832406 2022-02-24T06:52:07Z wsbmod.eth wsbmod
20882981 EclecticMethod 495235 2022-02-18T04:39:30Z eclecticm.eth Eclectic Method
811350 alexisohanian 479340 2022-02-08T06:31:55Z AlexisOhanian.eth 7️⃣7️⃣6️⃣ Alexis Ohanian 7️⃣7️⃣6️⃣
22784458 Fwiz 410813 2022-03-22T08:54:42Z Ryan Wyatt - fwiz.eth 💜 Ryan Wyatt - @ GDC
@tedivm
tedivm / queuerunner.py
Created February 15, 2022 16:46
Rob's QueueRunner
import logging
import multiprocessing as mp
import signal
import time
from queue import Empty, Full
from typing import Callable
import psutil
from pydantic import BaseSettings
@tedivm
tedivm / convert.sh
Last active January 12, 2022 14:56
Github Private to Internal
#!/usr/bin/env bash
# The "Internal" visibility is still in preview in the API.
# We cannot filter private and internal, so this script will
# convert internal to internal.
CONVERT_TO="internal"
if [[ -z "$1" ]]; then
echo "Organization required"
exit 1