Skip to content

Instantly share code, notes, and snippets.

View chuckwagoncomputing's full-sized avatar

David Holdeman chuckwagoncomputing

View GitHub Profile
@chuckwagoncomputing
chuckwagoncomputing / excuses.sh
Created November 28, 2015 01:14
BOFH excuses
#!/usr/bin/env bash
EXCUSES="/path/to/excuses.txt"
awk 'NR=='$((1 + $RANDOM % `nl $EXCUSES | tail -n 1 | awk '{print $1}' `))'{print;exit}' $EXCUSES
@chuckwagoncomputing
chuckwagoncomputing / wikimap.sh
Created November 15, 2025 11:11
Wiki to CSV for node map
(echo "from,to"; grep -Po '(?<=]\()((?!http)[^# /\n]+)(?=(#[^ /\n]*)?\))' !(_Sidebar).md 2>/dev/null | sed 's/\.md:/,/g' | sort | uniq) >map.csv
@chuckwagoncomputing
chuckwagoncomputing / w2l.el
Created November 15, 2025 01:12
rusEFI wiki2 to md link
(defun wiki-to-link ()
(interactive)
(when
(re-search-forward
"https:\/\/github.com\/rusefi\/rusefi\/wiki\/\\(\\([^ #\n]*\\)\\(#[^ \n]*\\)?\\)"
nil t)
(let* ((path (match-string 1))
(page (match-string 2))
(pagef (string-replace "-" " " page))
(link (concat "[" pagef "](" path ")")))
@chuckwagoncomputing
chuckwagoncomputing / rusefi.el
Created October 31, 2025 10:35
TunerStudio .msq to rusefi struct-setting C code
(defun rusefi-xml-to-c (struct)
"Convert msq xml to c code which sets values in STRUCT."
(interactive "sStruct:")
(let* ((d (libxml-parse-xml-region (region-beginning) (region-end)))
(n (rusefi-get-param 'name d))
(n
(if n
n
1))
(r (rusefi-get-param 'rows d))
@chuckwagoncomputing
chuckwagoncomputing / import.js
Created January 25, 2025 04:37
Dumb JS function for importing OTP token URIs to Bangle.js
function importToken(uri) {
var url = unescape(uri)
var groups = url.match(/totp\/([^:]+):?(.*)\?secret=([a-zA-Z0-9]+)&algorithm=([A-Z0-9]+)&digits=([0-9]+)&period=([0-9]+)/);
document.querySelector("[name='label']").value = groups[1];
document.querySelector("[name='secret']").value = groups[3];
document.querySelector("[name='account']").value = groups[2];
document.querySelector("[name='issuer']").value = groups[1];
document.querySelector("[name='period']").value = groups[6];
document.querySelector("[name='digits']").value = groups[5];
document.querySelector("[name='algorithm']").value = groups[4];
@chuckwagoncomputing
chuckwagoncomputing / gist:4234127
Last active February 2, 2024 14:25 — forked from matthew-french/gist:4234076
pbcopy ssh public key to your clipboard
#pbcopy < ~/.ssh/id_rsa.pub
#or
cat ~/.ssh/id_rsa.pub | pbcopy
@chuckwagoncomputing
chuckwagoncomputing / calendar.go
Created November 19, 2021 23:12
Calendar Generator
package main
import (
"os"
"fmt"
"time"
)
func main () {
year := 2022
@chuckwagoncomputing
chuckwagoncomputing / hackermode.sh
Created August 10, 2013 16:35
Hacker Mode - source from your bash profile
hackermode()
{
if [ "$1" == "on" ]; then
shopt -s extdebug
analyzer ()
{
LAST=`fc -ln -1 | cut -d " " -f 2`
if which $LAST &> /dev/null; then
which $LAST
elif type $LAST | grep builtin &> /dev/null; then
@chuckwagoncomputing
chuckwagoncomputing / hotplug.sh
Created January 1, 2021 04:27
Graphically un-hotplug drives
#!/usr/bin/env bash
LINE=""
DRIVES=$(ls /sys/block)
for DRIVE in $DRIVES; do
if ls /dev/$DRIVE 2>/dev/null >/dev/null && ls /sys/block/$DRIVE/device/delete 2>/dev/null >/dev/null; then
SIZE=$(blockdev --getsize64 /dev/$DRIVE | awk '{ split( "B KB MB GB TB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } print int($1) v[s] }')
LINE="$LINE p $DRIVE $SIZE"
fi
done
BLOCK=$(zenity --list --title "Choose drive to remove" --radiolist --column="Remove" --column="Device" --column="Size" $LINE)
@chuckwagoncomputing
chuckwagoncomputing / reclaimWindows10.ps1
Last active March 21, 2020 18:45 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1