Skip to content

Miscellaneous scripts

Small utilities that don't fit a larger category.

profile-shell

profile-shell

One-liner that times Zsh startup with zprof enabled:

.local/share/scripts/profile-shell
ZSHPROFILE=1 time -p zsh -i -c exit

.zshrc checks $ZSHPROFILE at the top and bottom — when set, it loads zsh/zprof early and prints a timing table on exit. The wrapper also gives you wall/user/system numbers via time -p.

print-colors

Prints a horizontal 24-bit RGB gradient bar to test that your terminal supports true color. The bar smoothly transitions through the full red/green/blue spectrum.

Useful as a smoke test after switching terminal, font, or TERM settings.

fzf-image-preview

fzf-image-preview <file>

Preview handler intended for use with fzf's --preview. Behaviour:

  • Directoryls -la --color.
  • Binary image → renders with chafa --passthrough=<auto|tmux> --size=<cols>.
  • Other binary → prints <file> is a binary file.
  • Textbat --style=numbers --color=always | head -100.

The passthrough mode is automatically tmux when running inside a tmux session, otherwise auto (chafa picks kitty graphics, sixel, or character art based on terminal capability).

Use as:

fzf --preview 'fzf-image-preview {}'

reset-background-items

reset-background-items

Wraps sudo sfltool resetbtm (resets all macOS background-task management state) with two "press any key" prompts: one before resetting, one before the required reboot.

Use this when macOS gets confused about which background items are authorized — usually manifests as repeated "Background Items Added" notifications, or login items that can't be disabled in System Settings.

Reboot required

sfltool resetbtm only takes effect after a reboot. The script prompts and runs sudo reboot for you.

brewfile

brewfile add <package> [brew bundle flags...]
brewfile remove <package>

Wraps the two-step day-2 Brewfile flow into one command:

  1. brew bundle <add|remove> "$@" --global — edit $HOMEBREW_BUNDLE_FILE_GLOBAL.
  2. brew bundle install --global — install (or, on remove with HOMEBREW_BUNDLE_INSTALL_CLEANUP=1, uninstall) so the Brewfile and the installed state stay in lockstep.

Flags after the action are passed through to brew bundle, so brewfile add --cask ghostty and brewfile add --tap user/tap work. See Brew bundle for the underlying commands and the environment variables that shape them.