Skip to content

Instantly share code, notes, and snippets.

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
ttscoff /
Created Dec 17, 2019
Fish completion for tm.bash
# ~/.config/fish/completions/
function __tm_has_no_args
set -l cmd (commandline -opc)
echo $cmd
return (test (count $cmd) -eq 1)
function __tm_has_windows
set -l cmd (commandline -opc)
set -l res (tmux list-windows -t $cmd[-1] 2>/dev/null >/dev/null)
ttscoff /
Last active Nov 11, 2019
Fish functions with commandline tricks
# Defined in /Users/ttscoff/.config/fish/functions/ @ line 1
function __prev_token -d "repeats last token on the command line"
set -l buffer (commandline -bo)
commandline -a " "$buffer[-1]
commandline -f end-of-line
# Defined in /Users/ttscoff/.config/fish/functions/ @ line 1
function __re_extension --description 'remove extension from word under/before cursor'
commandline -f forward-word
You can’t perform that action at this time.