Skip to content

Instantly share code, notes, and snippets.

@thmsmlr
thmsmlr / toggle-sleep
Created May 27, 2025 14:56
Toggle Sleep on MacOS
#!/bin/zsh
#
# toggle-sleep.sh – Disable system sleep when on AC power; re-enable on battery.
#
# Requires: sudo privileges for `pmset`. Run `sudo visudo` and add a NOPASSWD
# rule if you want it to run unattended:
# youruser ALL=(ALL) NOPASSWD: /usr/bin/pmset
#
# Install with:
# */1 * * * * /opt/homebrew/bin/zsh -i -c '/Users/thomas/.local/bin/toggle-sleep > /Users/thomas/.local/log/toggle-sleep.log'
@thmsmlr
thmsmlr / openai-say.sh
Created August 5, 2025 05:25
make Claude Code "Coding Agent Complete" when done working
#!/usr/bin/env bash
set -euo pipefail
### defaults ###############################################################
VOICE="alloy" # any voice listed in the docs, e.g. 'alloy' 'nova' …
SPEED=1.0 # 0.25 – 4.0 (1.0 = normal)
FORMAT="mp3" # mp3 | wav | flac …
VERBOSE=0
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/Library/Caches}/openai-say"