Skip to content

Instantly share code, notes, and snippets.

View zaxbux's full-sized avatar
👨‍💻

Zach Schneider zaxbux

👨‍💻
View GitHub Profile
#!/bin/bash
indent() { sed 's/^/ /'; }
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
# encode special characters per RFC 3986
urlencode() {
local LC_ALL=C # support unicode = loop bytes, not characters
local c i n=${#1}
for (( i=0; i<n; i++ )); do
c="${1:i:1}"
@zaxbux
zaxbux / getMacScreensaver.sh
Created May 12, 2024 07:39
Get macOS Screensaver and Settings
#!/bin/bash
loggedInUser=$(stat -f "%Su" /dev/console)
osVersion=$(/usr/bin/sw_vers -productVersion)
osVerMajor=$(echo "$osVersion" | /usr/bin/awk -F"." '{print $1}')
#osVerMinor=$(echo "$osVersion" | /usr/bin/awk -F"." '{print $2}')
#osVerPatch=$(echo "$osVersion" | /usr/bin/awk -F"." '{print $3}')
indent() { sed 's/^/ /'; }
@zaxbux
zaxbux / Extensions.md
Last active June 18, 2024 17:45
Mac sysadmin
@zaxbux
zaxbux / clean_downloads.sh
Created March 28, 2024 00:11
Delete user downloads that are older than 28 days (macOS)
#!/bin/bash
sudo -u $(stat -f "%Su" /dev/console) /bin/bash <<'END'
# Move files to user's trash
function trash() {
if [[ $# ]]; then
a=()
for f in "$@"; do a+=("$(realpath "$f")"); done
f=$(printf "\",POSIX file \"%s" "${a[@]}")\"
@zaxbux
zaxbux / README.md
Created October 5, 2023 07:45
ESP32-C6-DevKitC-1

Addressable RGB LED

light:
  - platform: esp32_rmt_led_strip
    id: led_gpio8
    name: "${friendly_name} Light"
    pin: GPIO8
    num_leds: 1
 rmt_channel: 0
@zaxbux
zaxbux / tubezb-cc2652p2-ethusb-2023.yaml
Created September 12, 2023 02:29
TubeZB CC2652P2 Ethernet/USB Coordinator ESPHome BLE Proxy
substitutions:
name: tubezb-cc2652p2-ethusb-2023
friendly_name: TubesZB and Bluetooth Proxy
esphome:
name: ${name}
friendly_name: ${friendly_name}
esp32:
board: esp32doit-devkit-v1
@zaxbux
zaxbux / gdocs.xml
Last active June 12, 2024 11:40
File Types
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/vnd.google-apps.document">
<comment>Google Docs</comment>
<glob pattern="*.gdoc" />
</mime-type>
<mime-type type="application/vnd.google-apps.drawing">
<comment>Google Drawings</comment>
<glob pattern="*.gdraw" />
</mime-type>
@zaxbux
zaxbux / README.md
Last active September 10, 2023 10:20
OpenSprinkler, Rust, Raspberry Pi
@zaxbux
zaxbux / README.md
Last active February 12, 2023 20:41
Raspberry Pi cmdline.txt options
@zaxbux
zaxbux / readme.md
Created January 27, 2023 00:15
CSP Policies