Skip to content

Instantly share code, notes, and snippets.

View ttscoff's full-sized avatar
💭
Breathing

Brett Terpstra ttscoff

💭
Breathing
View GitHub Profile
@ttscoff
ttscoff / gen_random_filename.bash
Last active August 29, 2015 14:02
Bash function to generate random 2-word underscore strings for filenames. Uses aspell and shuf (gnu coreutils).
# 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 https://gist.githubusercontent.com/ttscoff/55493fe89c35ec1588ba/raw/
# Requires shuf (brew install coreutils)
#
# Example results:
# darkest_pickpockets
# besets_struts
# unzip_Malone
@ttscoff
ttscoff / bitlyize.rb
Created October 25, 2014 22:30
Bitlyize Service/CLI to shorten links and automatically add affiliate tags
#!/usr/bin/ruby
# 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
# 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](https://www.youtube.com/watch?v=7m3o5LuFKxg&feature=youtu.be%EF%BB%BF)
* [Regarding the Gossip Girl and Tech Overlap](https://twitter.com/JohnLegere/status/551822878166245378%EF%BB%BF)
#!/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"
# Drag command set to handle: jpg,png,gif
# scoped to: text.html.basic source.css.embedded.html, source.css meta.scope.property-list.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
ttscoff / DefaultKeyBinding.dict
Created November 8, 2011 23:45
Flexible DefaultKeyBinding trick to continue plain text lists
// 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
ttscoff / doc2mmd.rb
Created February 5, 2012 17:53
rough draft of a Markdown converter for .doc files
#!/usr/bin/ruby
# 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(/(?=["\\])/, '\\')
end
ARGV.each {|f|
@ttscoff
ttscoff / hamlet.js
Created February 9, 2012 21:42
To be or not to be...
#!/bin/shakespeare -hamlet
function suffer() {
outrageous_fortune = true;
return false;
}
function oppose() {
if (take_arms(sea_of_troubles)) sleep;
die;