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 / 5by5showlinks.js
Created February 9, 2013 00:52
jQuery script to fetch all the links for a 5by5 show from the show notes as Markdown.
@ttscoff
ttscoff / 5by5showlinks-bookmarklet.js
Created February 9, 2013 00:53
Bookmarklet version of the 5by5 show links -> Markdown script
rake assets # copy site resources and dotfiles
rake bump # Bump version number
rake clean # Clean out caches: .pygments-cache, .gist-cache, .sass-cache
rake config[key,value] # Change or add a config setting
rake copydot[source,dest] # copy dot files for deployment
rake deploy # Default deploy task
rake draft[title] # Create a draft
rake draft_no_edit[title] # Create a draft without prompt
rake drafts # Alias for finddraft without requesting search terms
rake edit[file] # Open a text file in the default editor
@ttscoff
ttscoff / 5by5All.bookmarklet.md
Last active December 12, 2015 09:19
Generates a Markdown list of all the show links for a 5by5 show. Start it on the page for the first episode. Click the results once to select all for copying.
javascript:(function(){var%20collection%20%3D%20%5B%5D%3B%0Avar%20page%20%3D%201%3B%0Awhile%20(page%20%3E%200)%20%7B%0A%09%24.ajax(%7B%0A%09%09%20async%3A%20false%2C%0A%09%09%20type%3A%20'GET'%2C%0A%09%09%20url%3A%20window.location.href.replace(%2F(%5Cd%2B)%24%2F%2Cpage)%2C%0A%09%09%20success%3A%20function(data)%20%7B%0A%09%09%20%09%24data%20%3D%20%24(data)%3B%0A%09%09%09var%20epTitle%20%3D%20%24data.find('%23episode%20h2').first().text()%3B%0A%09%09%09var%20output%20%3D%20'%23%23%23%20%23'%2Bpage%2B'%3A%20'%2BepTitle%2B%22%5Cn%5Cn%22%3B%0A%09%09%09output%20%2B%3D%20'%5B**%5BShow%20link%5D('%2Bwindow.location.href.replace(%2F%5Cd%2B%24%2F%2Cpage)%2B%22)**%5D%5Cn%5Cn%22%0A%09%09%09%24data.find('%23episode_links').find('a').each(function()%7B%20output%20%2B%3D%20%22*%20%5B%22%2B%24(this).text().replace(%2F%5C%7C%2Fg%2C'-').replace(%2F%5B%5C%5B%5C%5D%5D%5D%2Fg%2C'**')%2B%22%5D(%22%2B%24(this).attr('href')%2B%22)%5Cn%22%20%7D)%3B%0A%09%09%09collection.push(output)%3B%0A%09%09%09page%20%2B%3D%201%3B%0A%09%
@ttscoff
ttscoff / com.brettterpstra.jekyll-dep.plist
Created February 12, 2013 00:44
launchd plist for a listener in my remote Jekyll build/deploy system
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>EnvironmentVariables</key>
<dict>
<key>LANG</key>
<string>en_US.UTF-8</string>
@ttscoff
ttscoff / downunder.rb
Created February 12, 2013 21:21
Possibly the dumbest script ever. Why make this gist public? Why not, I ask you, why not?
#!/usr/bin/ruby
input = STDIN.read
subs = {
" " => " ",
"a" => "ɐ",
"b" => "q",
"c" => "ɔ",
"d" => "p",
@ttscoff
ttscoff / Raketimer.rb
Created February 13, 2013 14:59
Example Rakefile additions for Jekyll task timer and push notifications
# Rake file tricks for timing and notifying task completion
# at the top of the file with other config settings
run_time = Time.now
# quick function to determine diff between passed time and now
def finish_timer(start_time)
finish_time = Time.now - start_time
total_min = "%d" % (finish_time / 60)
@ttscoff
ttscoff / gmailcheck.sh
Created February 15, 2013 12:38
Tiny bash functions for gmail
# Check your GMail using the provided Atom feed
# Assumes your GMail is your primary email address for the current user
# Also assumes that you've stored the password for your Google account in the keychain
# You know what happens when you assume... makes an ass out of you and Uma Thurman
gmail() {
user=`dscl . -read /Users/$(whoami)|grep "EMailAddress:"|sed 's/^EMailAddress: //'`
pass=$(security find-internet-password -w -a "$user" -s "accounts.google.com")
curl -u "$user:$pass" --silent "https://mail.google.com/mail/feed/atom"| perl -ne '
print "Subject: $1 " if /<title>(.+?)<\/title>/ && $title++;
print "(from $1)\n" if /<email>(.+?)<\/email>/;
@ttscoff
ttscoff / mailplane.css
Created February 17, 2013 13:59
MailPlane CSS for GMail grey theme
/* This stylesheet is designed to work with the grey theme for GMail
- hides the top bar and Google+ notifications
- simplifies buttons (remove border/background, add hover state back)
- dim Rapportive until hovered
This is only partially tested at this point and may cause some issues
Please let me know if you find problems: <http://brettterpstra.com/contact/>
Brett Terpstra 2013 <http://brettterpstra.com> /*
@ttscoff
ttscoff / lsz.sh
Last active February 20, 2025 09:59
A bash function that lists the contents of various types of archives. Easier to remember, faster to type.
# ls archives (inspired by `extract`)
lsz() {
if [ $# -ne 1 ]
then
echo "lsz filename.[tar,tgz,gz,zip,etc]"
return 1
fi
if [ -f $1 ] ; then
case $1 in
*.tar.bz2|*.tar.gz|*.tar|*.tbz2|*.tgz) tar tvf $1;;