Skip to content

Instantly share code, notes, and snippets.


Brett Terpstra ttscoff

View GitHub Profile
ttscoff / github_toc.rb
Last active Jan 24, 2023
A script to generate tables of contents for GitHub readme files
View github_toc.rb
#!/usr/bin/env ruby
# encoding: utf-8
github_toc v0.2.0
Brett Terpstra 2014
Creates a linked table of contents from headers in a GitHub readme
Place a [toc] marker in the file to have it automatically replaced with the TOC
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 / mindmeister_store.rb
Last active Dec 19, 2022
Store Markdown exports (as well as PDF and other formats) of all MindMeister maps in an account. See for usage
View mindmeister_store.rb
#!/usr/bin/env ruby
require 'digest/md5'
require 'uri'
require 'net/http'
require 'yaml'
require 'rexml/document'
require 'fileutils'
require 'time'
require 'open-uri'
ttscoff / Marker.js
Created Dec 22, 2013
Bookmarklet for Markdownifying webpage selections
View Marker.js
// Marker, a bookmarklet for Markdownifying webpage selections
// javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";"loadingp";"20px";"#fff";"20px";;"fixed";"9999999";".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src=""+(Math.random());})();
(function () {
function callback() {
(function ($) {
var raw, userSelection;
if (window.getSelection) {
// W3C Ranges
userSelection = window.getSelection ();
// Get the range:

Yosemite DNS cache flush:

sudo discoveryutil mdnsflushcache
sudo discoveryutil udnsflushcaches
ttscoff /
Created Jan 6, 2015
A script for exporting Safari Reading List items to Markdown files and Pinboard bookmarks
# ReadingListCatcher
# - A script for exporting Safari Reading List items to Markdown and Pinboard
# Brett Terpstra 2015
# Uses code from <>
# Requires Python pinboard lib for import:
# `easy_install pinboard` or `pip install pinboard`
import plistlib
from shutil import copy
import subprocess
ttscoff / searchlink.rb
Last active Dec 3, 2022
SearchLink creates Markdown links from automatic searches based on special syntax.
View searchlink.rb
View speedmail.applescript
Speed up by vacuuming the Envelope Index
Code from:
Originally by "pmbuko" with modifications by Romulo
Updated by Brett Terpstra 2012
Updated by Mathias Törnblom 2015 to support V3 in El Capitan and still keep backwards compability
Updated by @lbutlr for V5 and Container folder in High Sierra and use du
tell application "Mail" to quit
ttscoff / dontforget.bash
Last active Oct 18, 2022
Quick reminders from Terminal (bash)
View dontforget.bash
# dontforget
# A stupid script for short term reminders in bash
# Arguments just need to contain a number and a bunch of words.
# The number can be anywhere in the arguments, but there shouldn't
# be any other numeric digits.
ttscoff / tagfiler.rb
Last active Oct 10, 2022
Moves files to folders based on special tags in OS X Mavericks
View tagfiler.rb
#!/usr/bin/env ruby
# encoding: utf-8
# tag primary folders =Tagname
# target them with #Tagname
# tag subfolders with @nickname
# target them with :nickname
# if no tagged folder exists but there's a matching folder name, that's used
# otherwise it will create folders based on :tags
# :tags can be strung together :bt:Drafts:testing for nesting
# Only one #Tag and one :path should exist in a file's tags