Skip to content

Instantly share code, notes, and snippets.

@brett6320
brett6320 / SwiftDefaultApps.md
Created October 11, 2025 21:59
Manage default apps through a single PrefPane on macOS - this is helpful for changing default mail client when Mail is blocked by corporate endpoint policies.

ANNOUNCEMENT: I have recently noticed Apple has introduced replacements for the deprecated APIs used in this prefpane. As a result, slow as it may be, I plan to resume development. I will be taking PRs as well, if somebody wishes to contribute.

SwiftDefaultApps

This Preference pane is chiefly intended to be a modern replacement for the amazing RCDefaultApp developed way back when by Carl Lindberg, which stopped working in 10.12 due to deprecation of ObjC Garbage collection. Additionally, I guess it was a good way to teach myself Swift.

Feel free to contribute, comment or report issues at https://github.com/Lord-Kamina/SwiftDefaultApps.

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your Oh My Zsh installation.
if [ -d ~/.oh-my-zsh ]
then
export ZSH="$HOME/.oh-my-zsh"
fi
# Set name of the theme to load --- if set to "random", it will
function duckdb-start () {
if [ -f "$PWD/.duckdb_startup.sql" ]
then
duckdb -init "$PWD/.duckdb_startup.sql" ${@}
elif [ -f "$HOME/.duckdb/startup.sql" ]
then
duckdb -init "$HOME/.duckdb/startup.sql" ${@}
fi
}
aws-clear-identity () {
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_SESSION_TOKEN
unset AWS_SECURITY_TOKEN
unset AWS_PROFILE
}
aws-assume-role() {
" Convert tabs to spaces when typing
" Documentation: https://neovim.io/doc/user/options.html#'expandtab'
set expandtab
" Set tab width to 2 columns (visual display width of tab character)
" Documentation: https://neovim.io/doc/user/options.html#'tabstop'
set tabstop=2
" Set indentation width to 2 spaces for << and >> operations
" Documentation: https://neovim.io/doc/user/options.html#'shiftwidth'
@brett6320
brett6320 / Invert Scrolling.applescript
Created October 8, 2025 19:54
This AppleScript can be run as Shortcut to invert scrolling when switching between Trackpad and traditional mice/pointing devices.
-- This AppleScript can be run as Shortcut to invert scrolling when switching between
-- Trackpad and traditional mice/pointing devices.
tell application "System Settings"
activate
end tell
tell application "System Events"
tell process "System Settings"
delay 0.5
click menu item "Trackpad" of menu "View" of menu bar 1
@brett6320
brett6320 / run.tpl
Created May 28, 2022 16:18 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}