Skip to content

Instantly share code, notes, and snippets.


Brett Terpstra ttscoff

View GitHub Profile
ttscoff / gen_random_filename.bash
Last active Aug 29, 2015
Bash function to generate random 2-word underscore strings for filenames. Uses aspell and shuf (gnu coreutils).
View gen_random_filename.bash
# Bash function gen_random_filename
# Description: Generates random two-word names
# Requires a dictionary file, easily generated with `aspell dump master > dictionary.txt`
# or grab it from
# Requires shuf (brew install coreutils)
# Example results:
# darkest_pickpockets
# besets_struts
# unzip_Malone
ttscoff / new_podcast.rb
Last active Aug 29, 2015
Create a new Sublime Text workspace with 4 vertical columns and starter note buffers
View new_podcast.rb
# new_podcast.rb
# Create a new Sublime Text workspace with 4 vertical columns and starter note buffers
# Brett Terpstra 2014
# Free to use and modify (WTF license)
# Usage: new_podcast.rb episode_title
require 'fileutils'
# By default new workspaces are created in subdirs off the current directory
# modify project_root to always have them built in a specific location, (e.g. project_root = "~/Dropbox/Podcasts")
ttscoff / bitlyize.rb
Created Oct 25, 2014
Bitlyize Service/CLI to shorten links and automatically add affiliate tags
View bitlyize.rb
# encoding: utf-8
# Bitlyize by Brett Terpstra 2014
# Shortens all URLs in input and automatically adds Amazon and iTunes affiliate codes
# A single bitly link passed to this script will return the long url
# This script was designed for use in an OS X System Service, but runs
# as a CLI and can be included as a Ruby library in other scripts
# The bitly_username and bitly_key variables are required
# Optionally configure the custom domain, and itunes and amazon affiliate variables
View a.txt
# Overtired 26
Brett and Christina skip CES to reminisce about Mean Girls. Yeah, Taylor Swift came up, but we didn't dwell on it. We're growing.
From drunken, -20° snow shoveling to watching some great new movies by the fire, this is a mid-winter show that has it all. Don't they always, though? Jack of all trades, master of, well, we're pretty good at pop culture...
## Links
* [The amazing Taylor Swift mashup of the two best songs from 1989](
* [Regarding the Gossip Girl and Tech Overlap](
View Songza Lucky Link TextMate Command
View Songza Link Selection (TextMate Command)
View NerdTool RSS Script
#!/usr/bin/env ruby -rjcode -Ku
require 'rss/2.0'
require 'open-uri'
require 'time'
class RSSFetcher
RED = "\033[1;31m"
GREEN = "\033[32m"
YELLOW = "\033[33m"
View TextMate Drag Command for Base64-encoded images in CSS
# Drag command set to handle: jpg,png,gif
# scoped to: text.html.basic source.css.embedded.html, source.css
openssl base64 -in "$TM_DROPPED_FILE" | awk -v ext="${TM_DROPPED_FILE#*.}" '{ str1=str1 $0 }END{ print "background:url(data:image/"ext";base64,"str1");" }'
ttscoff / DefaultKeyBinding.dict
Created Nov 8, 2011
Flexible DefaultKeyBinding trick to continue plain text lists
View DefaultKeyBinding.dict
// Add to (or create) ~/Library/KeyBindings/DefaultKeyBinding.dict
// Incorporated change by Lri to not require additional words on the line to work
// fixed to handle first character of list item being non-alphanumeric
// Issues:
// If there are more than one symbols ([[, ![, etc.) at the beginning of the line, anything beyond the first one is captured and added to new line
// FIXED: Entering more than one blank item in a row and then using ⌘Z leaves a placeholder character on the previous line.
ttscoff / doc2mmd.rb
Created Feb 5, 2012
rough draft of a Markdown converter for .doc files
View doc2mmd.rb
# doc2mmd.rb
# rough draft of a Markdown converter for .doc files
# requires python html2text, edit path in last shell call
def e_sh(str)
str.to_s.gsub(/(?=["\\])/, '\\')
ARGV.each {|f|