Skip to content

Instantly share code, notes, and snippets.

View karabiner.json
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@tjluoma
tjluoma / url2image.sh
Created Aug 7, 2021
Use 'wkhtmltoimage' to save an URL to a unique filename in a designated folder
View url2image.sh
#!/usr/bin/env zsh -f
# set this to whatever URL you want to capture
URL='https://www.abc.com'
# folder where do you want screenshots to go
# the folder will be created if it does not exist
DIR="$HOME/Desktop/Screenshots"
# could also be 'png' if you prefer
View letsencrypt-output.txt
# Output of: `sudo ls -lRa /etc/letsencrypt`
```
total 16
drwxr-xr-x 12 root wheel 384 Jul 15 21:56 .
drwxr-xr-x 96 root wheel 3072 Jul 2 11:17 ..
-rw-r--r-- 1 root wheel 64 Feb 29 2020 .updated-options-ssl-apache-conf-digest.txt
drwxr-xr-x 3 root wheel 96 Oct 25 2018 accounts
drwxr-xr-x 24 root wheel 768 May 15 09:35 archive
@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