Skip to content

Instantly share code, notes, and snippets.

@tjluoma
tjluoma / menubar-visibility.sh
Created May 4, 2021
Show, change, toggle the menu bar visibility on macOS Big Sur
View menubar-visibility.sh
#!/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.every3minutes.plist
Created Feb 23, 2021
launchd - run a command every 3 minutes, during working hours, on a weekday
View com.tjluoma.every3minutes.plist
<?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 / ExportKindle.js
Last active Jan 26, 2021 — forked from jkubecki/ExportKindle.js
Amazon Kindle Export
View ExportKindle.js
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
// https://gist.github.com/jkubecki/d61d3e953ed5c8379075b5ddd8a95f22
// including change recommended by @nexnovati
// https://gist.github.com/jkubecki/d61d3e953ed5c8379075b5ddd8a95f22#gistcomment-3439531
// works as of 2021-01-26 with Google Chrome 88.0.4324.96
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
@tjluoma
tjluoma / com.tjluoma.lockscreen.plist
Created Jan 1, 2021
This AppleScript will lock your Mac at 5pm and midnight [see installation info below]
View com.tjluoma.lockscreen.plist
<?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>
@tjluoma
tjluoma / arch.sh
Last active Dec 28, 2020
Find the actual arch (arm64 or i386) of a Mac, even if running in Rosetta
View arch.sh
## 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 / gist:bfb9f452b8c469e77227a674615f4f55
Created Nov 27, 2020
try various fixes for recent problems with Mac App Store on Mojave: “We could not complete your purchase” / “cancelled”
View gist:bfb9f452b8c469e77227a674615f4f55
#!/usr/bin/env zsh -f
# Purpose: Try to get the Mac App Store on Mojave to let Mac App Store apps update without "cancelled" message
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2020-11-25
PATH='/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin'
pgrep -x 'App Store' && killall 'App Store'
@tjluoma
tjluoma / backupmas.sh
Created Nov 25, 2020
backup all of your Mac App Store apps
View backupmas.sh
#!/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
View resultscompleted.sh
#!/usr/bin/env zsh -f
# Purpose: This script will email all PDFs from one folder to a designated recipient
#
# Note: this script uses 'emate' which is a part of MailMate.app (https://freron.com)
# and assumes that the app is already properly configured to send email.
# change this to the email address you want to send the files to
MAIL_TO='admin@notreal.com'
# this is the folder where the PDFs will be sent from
@tjluoma
tjluoma / di-skypecallrecorder.sh
Last active Oct 10, 2020
If you customize one line in this script, it will download and install / update Skype Call Recorder.
View di-skypecallrecorder.sh
#!/usr/bin/env zsh -f
# Purpose: Download and install the latest version of Skype Call Recorder
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2018-08-22
# you MUST customize this URL to be your URL from ECamm
# it ends with your email address (URL encoded) and a 6 digit personal code
@tjluoma
tjluoma / podcastdownloader.sh
Created Sep 2, 2020
Download all enclosures in a podcast/RSS feed
View podcastdownloader.sh
#!/usr/bin/env zsh -f
# Purpose: Download enclosures from a podcast feed
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2020-09-01
# this is a variable we can use to refer to the name of this script
# for example, if the filename is
# /usr/local/bin/podcastdownloader.sh