Skip to content

Instantly share code, notes, and snippets.

View ttscoff's full-sized avatar
💭
Breathing

Brett Terpstra ttscoff

💭
Breathing
View GitHub Profile
debug1: Remote: /Users/ttscoff/.ssh/authorized_keys:11: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /Users/ttscoff/.ssh/authorized_keys:11: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending command: ls
@ttscoff
ttscoff / grab links.bookmarklet
Last active June 16, 2024 16:40
Create a bookmark and paste the code from `grab links.bookmarklet` into the url. Trigger it on a page containing links you want to save and then click the section of the page containing the links. A Markdown list of all links will be generated, and clicking the resulting list will select all for copying.
@ttscoff
ttscoff / dontforget.bash
Last active June 12, 2024 21:04
Quick reminders from Terminal (bash)
#!/bin/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
ttscoff / appinfo.md
Last active June 11, 2024 18:07
appinfo: A quick ruby script for Mac that returns some information for a specified Mac app in Terminal. Includes icon display if using imgcat or chafa are available.

appinfo

A script for getting details of installed Mac apps. Like Get Info but faster and cooler.

Save the script below as appinfo somewhere in your path. Make it executable with chmod a+x appinfo. Then just run appinfo APPNAME to get info on any installed app.

@ttscoff
ttscoff / flavor.rb
Created September 16, 2012 16:01
Quick wrapper to convert Markdown to HTML via Github API
#!/usr/bin/ruby
# Convert a Markdown README to HTML with Github Flavored Markdown
# Github and Pygments styles are included in the output
#
# Requirements: json gem (`gem install json`)
#
# Input: STDIN or filename
# Output: STDOUT
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file
# cat README.md | flavor > README.html
@ttscoff
ttscoff / matrixish.sh
Created September 15, 2012 18:23
A Matrix-ish display for Bash terminal
#!/bin/bash
#
# matrix: matrix-ish display for Bash terminal
# Author: Brett Terpstra 2012 <http://brettterpstra.com>
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/>
#
# A morning project. Could have been better, but I'm learning when to stop.
### Customization:
blue="\033[0;34m"
@ttscoff
ttscoff / grabicon.rb
Last active May 2, 2024 07:53
Grab an iOS or Mac app icon from local version or iTunes search
#!/usr/bin/env ruby -W1
# frozen_string_literal: true
# Mac only
#
# Usage: grabicon.rb SEARCH TERMS [%[small|medium|large] [@[mac|ios|iphone|ipad]]
# If the search terms match a local app, that app's icon will be extracted and converted to PNG
# If the search terms don't match a local app, iTunes will be searched
# If the search terms end with "@mac", "@iphone", "@ipad", or "@ios", iTunes will be searched for a match
# If the search terms end with "%large", "%medium", "%small", or "%XXX" icon will be scaled to size
@ttscoff
ttscoff / ezsnippets.rb
Last active March 30, 2024 21:17
ezsnippets v1, define expansions as you write (based on work by Stephen Margheim: http://www.alfredforum.com/topic/4680-snippets-on-the-fly-text-expansion/))
#!/usr/bin/ruby
=begin
# ezsnippets
Brett Terpstra 2014, MIT License
Based on a great idea by Stephen Margheim <http://twitter.com/s_margheim>
- http://www.alfredforum.com/topic/4680-snippets-on-the-fly-text-expansion/
- https://github.com/smargh/alfred_snippets
@ttscoff
ttscoff / md_to_bike.rb
Last active March 22, 2024 18:42
This script takes simple Markdown lists and converts them for use in Bike
#!/usr/bin/env ruby
# frozen_string_literal: true
# This script takes simple Markdown lists and converts them for use in
# Bike (https://www.hogbaysoftware.com/bike/), a Mac outliner app from
# Hog Bay Software.
#
# It doesn't handle nested code blocks or any non-list Markdown. It just
# turns simple lists into text Bike will recognize when it's pasted into
# a Bike document. Multiple paragraphs in a list item become additional
@ttscoff
ttscoff / tagfiler.rb
Last active March 22, 2024 18:41
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