Skip to content

Instantly share code, notes, and snippets.

@tjluoma
tjluoma / di-xquartz.sh
Last active January 19, 2023 13:38
Install (or update, if necessary) XQuartz. Especially useful if you use use Homebrew (http://brew.sh) which won't install or update it, but will complain if it is not installed or outdated.
#!/bin/zsh -f
# Download and install (or update) Xquartz
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2014-06-10
NAME="$0:t:r"
APP_PATH='/Applications/Utilities/XQuartz.app'
@tjluoma
tjluoma / com.tjluoma.updatebrew.plist
Created June 10, 2014 23:48
`launchd` plist to run `updatebrew.sh` at 3:03 a.m. every night
<?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>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin</string>
</dict>
<key>Label</key>
@tjluoma
tjluoma / autosave-msword.scpt
Last active January 6, 2023 21:18
I use this with a Keyboard Maestro macro that runs whenever MSWord “deactivates” (in Keyboard Maestro terms). Updated with comments from http://apple.stackexchange.com/a/132171/9226
on hasDocument()
tell application "Microsoft Word"
every document is not missing value
end tell
end hasDocument
tell application "Microsoft Word"
if it is running and my hasDocument() then
save active document
end if
end tell
@tjluoma
tjluoma / youtube-rss.sh
Last active January 3, 2023 09:00
Did you know YouTube has RSS feeds? No? Probably because YouTube makes them nearly impossible to find. But here's an easy way to get the RSS feed for any YouTube user. Inspired by <https://eggfreckles.net/notes/youtube-rss/>
#!/usr/bin/env zsh -f
# Purpose: get the RSS feed for a YouTube page
# Inspired By: https://eggfreckles.net/notes/youtube-rss/
# Gist: https://gist.github.com/tjluoma/fdbc63ceb78a2aecd3d638fd18b6ec6e
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2020-01-17; updated 2021-01-10
# 2021-01-10 YouTube currently has both 'rssUrl' and
@tjluoma
tjluoma / pdf-rename-by-cdate.sh
Created December 26, 2019 21:55
rename PDF files by their creation date (as determined by PDF metadata)
#!/usr/bin/env zsh -f
# Purpose: rename PDFs by their creation date
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2019-12-26
NAME="$0:t:r"
if [[ -e "$HOME/.path" ]]
@tjluoma
tjluoma / osxcombo.sh
Created February 9, 2015 20:51
Download and install the OS X combo updater
#!/bin/zsh
# Purpose: Download and install Mac OS X’s combo updater
#
# From: Tj Luo.ma
# Mail: luomat at gmail dot com
# Web: http://RhymesWithDiploma.com
# Date: 2014-05-15
# This is the only thing you _have_ to change
URL='http://support.apple.com/downloads/DL1786/en_US/OSXUpdCombo10.10.2.dmg'
{
"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 August 7, 2021 04:52
Use 'wkhtmltoimage' to save an URL to a unique filename in a designated folder
#!/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
# 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 / podcastdownloader.sh
Created September 2, 2020 01:25
Download all enclosures in a podcast/RSS feed
#!/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