Skip to content

Instantly share code, notes, and snippets.

@tjluoma
tjluoma / menubar-visibility.sh
Created May 4, 2021 10:41
Show, change, toggle the menu bar visibility on macOS Big Sur
#!/usr/bin/env zsh -f
# Purpose: Toggle, or check, the menu bar visibility. Tested on macOS 11.
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2021-05-04
NAME="$0:t:r"
SCRIPT_NAME="$0"
@tjluoma
tjluoma / com.tjluoma.on_networkchange.plist
Created August 22, 2012 21:07
run a shell script whenever a Mac's network information changes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AbandonProcessGroup</key>
<true/>
<key>Label</key>
<string>com.tjluoma.on_networkchange</string>
<key>ProgramArguments</key>
<array>
@tjluoma
tjluoma / km-timemachine-mount-run-unmount.sh
Last active November 20, 2023 07:52
a variation of 'timemachine-mount-run-unmount.sh' meant to be used with Keyboard Maestro
#!/usr/bin/env zsh -f
# Purpose: Once you set the DEVICE,
# this script will mount your Time Machine drive,
# run Time Machine,
# and then unmount the drive
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2020-04-20
#!/usr/bin/env zsh -f
# This tells the script to get the $PATH from the ~/.path file if it exists
# otherwise it will use the second $PATH in the "else" clause
if [[ -e "$HOME/.path" ]]
then
source "$HOME/.path"
else
PATH='/usr/local/scripts:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin'
fi
@tjluoma
tjluoma / crashplanFixup.sh
Last active May 23, 2023 14:59 — forked from thewellington/crashplanFixup.sh
disables de-duplication in CrashPlan, which makes upload speeds much faster. Note: @thewellington did all the hard work here, I just added some to it.
#!/bin/zsh
# Purpose: disable deduplication in CrashPlan
#
# From: Tj Luo.ma
# Mail: luomat at gmail dot com
# Web: http://RhymesWithDiploma.com
# Date: 2014-03-23
#
#
# Forked from: <https://gist.github.com/thewellington/8984012>
@tjluoma
tjluoma / backupmas.sh
Created November 25, 2020 17:17
backup all of your Mac App Store apps
#!/usr/bin/env zsh -f
# Purpose: Create a backup of all Mac App Store apps
# NTS: like 'backup-mas-apps.sh' but without growlnotify
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2019-06-01
# point this to wherever you want backups to be made.
# it will be created if it does not exist
@tjluoma
tjluoma / macos-is-at-least.sh
Last active April 6, 2023 18:40
zsh script to compare macOS Versions - see https://rhymeswithdiploma.com/2020/07/10/macos-is-at-least/ for full explanation
#!/bin/zsh -f
# Purpose: Check to see if we are running on Big Sur
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2020-07-10
PATH="/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin"
# this will check to make sure `sw_vers` exists
@tjluoma
tjluoma / arch.sh
Last active April 5, 2023 21:22
Find the actual arch (arm64 or i386) of a Mac, even if running in Rosetta
## Note - this should work in bash and zsh scripts
ARCH=$(sysctl kern.version | awk -F'_' '/RELEASE/{print $2}')
if [[ "$ARCH" == "ARM64" ]]
then
ARCH='arm64'
elif [[ "$ARCH" == "X86" ]]
then
ARCH='i386'
@tjluoma
tjluoma / com.tjluoma.every3minutes.plist
Created February 23, 2021 15:01
launchd - run a command every 3 minutes, during working hours, on a weekday
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.tjluoma.test</string>
<key>Program</key>
<string>/usr/bin/true</string>
<key>RunAtLoad</key>
<false/>
@tjluoma
tjluoma / com.tjluoma.lockscreen.plist
Created January 1, 2021 20:52
This AppleScript will lock your Mac at 5pm and midnight [see installation info below]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>com.tjluoma.lockscreen</string>
<key>ProgramArguments</key>
<array>