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 / aliaslast.bash
Last active February 20, 2025 09:52
Alias last command in bash and save
# alias last and save
# use `als c NAME` to chop off the last argument (for filenames/patterns)
als() {
local aliasfile chop x
[[ $# == 0 ]] && echo "Name your alias" && return
if [[ $1 == "c" ]]; then
chop=true
shift
fi
aliasfile=~/.bash_it/aliases/custom.aliases.bash
@ttscoff
ttscoff / lazylink.rb
Created October 19, 2013 18:56
Marked 2 Preprocessor for "lazy links"
@ttscoff
ttscoff / randommarkdown.rb
Created October 26, 2013 20:58
Generates a ton of Lorem Ipsum Markdown text for testing/filler purposes. Easily modifiable output.
#!/usr/bin/ruby
# Generates a bunch of random Markdown text (with footnotes/tables)
# REQUIREMENTS:
# raingrams gem ([sudo] gem install raingrams)
# a text file at ~/words/alice.txt containing lots of words
# I recommend using mine from http://ckyp.us/kZWQ
require 'rubygems'
require 'raingrams'
@ttscoff
ttscoff / listtags.bash
Last active February 20, 2025 09:50
Bash function to search the current directory for files based on Mavericks tags.
# Updated 2013-10-31 to handle:
# listing all files with tags
# list only files without tags
# and deal with spaces in filenames (that part got ugly).
# Also, set the query variable to local
# List files with specified Finder tags in current directory and subdirectories
# Works with partial words starting from the beginning of the word
lst() {
@ttscoff
ttscoff / chrome2of.applescript
Created October 27, 2013 16:52
Instant list of current Chrome tabs to an OmniFocus inbox task. Based on work by Veritrope and Zettt.
(*
http://veritrope.com
Google Chrome URLs List to OmniFocus
Version 1.0
April 23, 2011
Project Status, Latest Updates, and Comments Collected at:
http://veritrope.com/code/safari-tab-list-to-omnifocus
=========
BASED ON THIS SAFARI/EVERNOTE SCRIPT:
http://veritrope.com/code/export-all-safari-tabs-to-evernote/
@ttscoff
ttscoff / customreader-lopash.css
Created October 29, 2013 14:04
Lopash style for CustomReader II Safari Extension
@font-face {
font-family: 'Quattrocento';
font-style: normal;
font-weight: 400;
src: url("data:font/ttf;base64,AAEAAAAQAQAABAAARkZUTWCC9MgAAnHsAAAAHE9TLzJtiUIsAAABiAAAAGBjbWFwqzmq7QAABUQAAAHSY3Z0IAusAkAAAA68AAAAMGZwZ21Bef+XAAAHGAAAB0lnYXNwAAAAEAACceQAAAAIZ2x5Zrg1RrEAABCcAAGoIGhlYWT6jHmFAAABDAAAADZoaGVhB5ED7QAAAUQAAAAkaG10eKtfHrYAAAHoAAADXGtlcm5QLGBkAAG4vAAAqiJsb2NhzGU3ggAADuwAAAGwbWF4cAHjBe4AAAFoAAAAIG5hbWWiv9tgAAJi4AAADQJwb3N0Ooou5wACb+QAAAH/cHJlcK7czoYAAA5kAAAAVgABAAAAAgAApKqGtV8PPPUAHwPoAAAAAMuNGyoAAAAAy40bKv/i/vwEXANQAAAACAACAAAAAAAAAAEAAANQ/vwAAARI/+L/0QRcAAEAAAAAAAAAAAAAAAAAAADXAAEAAADXAK4ABQAAAAAAAgAoADMAPAAAAKIFCwAAAAAAAwH/AZAABQAAArwCigAAAIwCvAKKAAAB3AAyAPoAAAICBQIDAAAABASAAAC/QAAASwAAAAAAAAAAUFlSUwBAAA0iFQNQ/vwAAANQAQQAAAABAAAAAACBApkAAAAgAAED6AAAAAAAAAD9AAAAAAAAAPAAAAD2AEwBMgA1Am4AKgIVADEDDwAsAvMANQCsADUBDwAoAQ8ADgG3AEEB7wAyANUAMwHXAEMA2QA+AbIAKAKGADoBYgAqAhgALgIgADYB/AAVAhMANQIgAEMCAAAkAi4AOgIgADEA4wBDAOkAQAGeACwB6ABLAZ4ASAGoAC4C0gA4AqP/7QJLACsCigA2At4AKwI7ACsCEQArAsQANgL4ACsBTQArAT4AEQKQA
@ttscoff
ttscoff / lazyfootnotes.rb
Created October 29, 2013 17:32
Lazy footnotes for Markdown, based on TidBits lazy link style
#!/usr/bin/env ruby
# encoding: utf-8
=begin
http://marked2app.com
Marked 2 preprocessor - "Lazy" footnotes.
Allows use of `[^]` or `†` footnote references
where the next [^]: or †: note defines the text of the footnote.
@ttscoff
ttscoff / voicesms.rb
Last active December 27, 2015 00:39
Google voice SMS from command line. I've lost track of versions...
#!/usr/bin/env ruby -Ku
require 'net/http'
require 'net/https'
require 'open-uri'
require 'cgi'
require 'optparse'
ACCOUNT = 'USERNAME' # Set to Google Voice account email for default account
PASSWORD = 'PASSWORD' # Set to Google Voice account password for default account
@ttscoff
ttscoff / tagfiler.rb
Last active March 22, 2025 09:34
Moves files to folders based on special tags in OS X Mavericks
#!/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
@ttscoff
ttscoff / ifttt-pocket_to_nvalt.rb
Created November 1, 2013 12:05
A Hazel script for converting IFTTT-saved Pocket favorites to nvALT notes
#!/usr/bin/env ruby
# Works with IFTTT recipe https://ifttt.com/recipes/125999
#
# Set Hazel to watch the folder you specify in the recipe.
# Make sure nvALT is set to store its notes as individual files.
# Edit the $target_folder variable below to point to your nvALT
# ntoes folder.
require 'date'
require 'open-uri'
require 'net/http'