Skip to content

Instantly share code, notes, and snippets.

View linkchecker.js
if ((/^localhost/).test( {
var linkChecker = (function() {
"use strict";
let links, errors = [], completed = [], errorCounter = 0;
function addStyle(styleString) {
const style = document.createElement("style");
style.textContent = styleString;
ttscoff / close zoom tabs.applescript
Created Nov 6, 2020
Close all those tabs that got left open in Safari
View close zoom tabs.applescript
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set tabsToClose to {}
tell application "Safari"
-- cycle through all open windows
repeat with _window in windows
-- cycle through all tabs of given window
repeat with _tab in tabs of _window
ttscoff / geticonpng.bash
Created Sep 12, 2020
Grab a PNG of any local Mac app icon
View geticonpng.bash
# get any app's full-size icon, PNG version
function geticonpng() {
# Autocompletes app names with modified .app_completions scripts
APP=`echo $1|sed -e 's/\.app$//'`
for dir in "/Applications/" "/Applications/Setapp/" "/Applications/Utilities/" "/Users/ttscoff/Applications/" "/Developer/Applications/" "/Developer/Applications/Utilties/" "/System/Applications/"; do
if [[ -d "${dir}$" ]]; then
ttscoff / Podcast.bunch
Last active Sep 15, 2020
Brett's bunch for podcasting
View Podcast.bunch
# Start podcasting
## Some time tracking
& workflows/Timing
- task = Podcasting
- project = Podcasting
## Do not disturb me, audio settings
(dnd on)
ttscoff / volumetoggle.rb
Created Sep 11, 2020
Script for macOS to save and restore audio input/output device and volume settings
View volumetoggle.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
# Brett Terpstra <>
# macOS: Stores all input/output devices and volume settings to a
# text file, restores on demand
## Dependencies
# SwitchAudioSource <>
ttscoff / Dropbox and Backblaze.bunch
Created Aug 7, 2020 pause/resume tricks for Dropbox and Backblaze (ideal for Podcast-related Bunches)
View Dropbox and Backblaze.bunch
# Tricks for
# <>
# Normally we would quit Dropbox just by using:
# !Dropbox
# But Dropbox has some issues with an AppleScript-style quit
# so we revert to sending a KILL signal via shell script
$ killall Dropbox
# if you want to open the Dropbox process when toggling
ttscoff / convert_to_quiver.rb
Created Apr 30, 2020
Markdown files to Quiver JSON
View convert_to_quiver.rb
#!/usr/bin/env ruby
require 'json'
require 'fileutils'
notebook = File.expand_path('~/Desktop/NewSnippets.qvnotebook')
nbmeta = {
"name" => "NewSnippets",
"uuid" => %x{uuidgen}.strip
ttscoff / mmdtagstomacos.rb
Last active Apr 18, 2020
Read MultiMarkdown metadata tags from files and apply them as macOS tags
View mmdtagstomacos.rb
#!/usr/bin/env ruby
# encoding: utf-8
# Read MultiMarkdown metadata tags from files and apply them as macOS tags
# Usage:
# mmdtagstomacos.rb *.md
require 'shellwords'
mmd = '/usr/local/bin/multimarkdown'
ttscoff /
Created Feb 18, 2020
Dad jokes for Fish shell
# You're welcome
function dadjoke -d 'Get a dad joke from'
curl -H "Accept: text/plain"
ttscoff / tunes.rb
Created Feb 15, 2020
CLI controls for Spotify and (Apple) Music
View tunes.rb
#!/usr/bin/env ruby
# encoding: utf-8
# CLI music controller for Spotify and Apple Music
# By default affects whichever one is running, preferring Spotify
# if both are. Change the order of KNOWN_PLAYERS to reverse that.
# If the first argument is either "music" or "spotify," it will
# target that app. If the app is not running, it will be launched.
# When no app is specified and neither are running, it returns nothing