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 / gitlogtoday.sh
Created January 31, 2012 02:31
Git log for the last day, formatted for journal insertion
git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short --since="`date -v-1d '+%m/%d/%y'`"
Prettier:
git log --pretty=format:"%ad | [`pwd`]%n- %s%d" --graph --date=short --since="`date -v-1d '+%m/%d/%y'`"
@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;
@ttscoff
ttscoff / tp-dailylog.rb
Created February 26, 2012 04:33
Daily background logger to write completed TaskPaper tasks (system-wide) to a Day One entry
#!/usr/bin/ruby
# tp-dailylog.rb - Log TaskPaper tasks completed on the current day to a Day One entry
# Brett Terpstra 2012 <http://brettterpstra.com>
#
# Run it with launchd at 11pm and forget about it
#
# Notes:
# * Uses `mdfind` to locate all .taskpaper files changed in the last day
# * Scans for @done(xxxx-xx-xx) tags in each line matching today's date
# * Does not alter TaskPaper files in any way
@ttscoff
ttscoff / massnippet.txt
Created March 18, 2012 20:52
Auto-redeem link for Mac App Store promo codes
macappstores://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/redeemLandingPage?code=XXXXXXXXX
@ttscoff
ttscoff / test.htaccess
Created March 20, 2012 00:15
Redirect trailing slash to .html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*?/)?([^/]+)/$ http://www.domain.com/$1$2.html [R=301,L]
#!/usr/bin/ruby
=begin
Uses MultiMarkdown (must be installed at /usr/local/bin/multimarkdown) to render input,
then converts `{{text}}` to `<u>text</u>`, providing underlines in the HTML output.
=end
input=STDIN.read
def e_sh(str)
@ttscoff
ttscoff / keybindings.html
Created April 22, 2012 17:13
Updated Cheaters cheatsheet for Brett's Keybindings.dict
<table>
<caption id="generalcommands"> General Commands </caption>
<colgroup>
<col style="text-align:center;"/>
<col style="text-align:left;"/>
</colgroup>
<thead>
<tr>
<th style="text-align:center;" colspan="2">General Commands</th>
@ttscoff
ttscoff / commenttest.md
Created May 4, 2012 13:13
Persistent Marked styles in HTML comments

Testing styles in comments

Marked will find metadata such as "Marked Style:" anywhere in the document as long as it's the first thing on a line. This means you can surround the line with HTML comments and still have persistent styles without the metadata showing up in other systems that don't process it.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

@ttscoff
ttscoff / gitlogger.rb
Last active February 20, 2025 10:12
Archive marked git repositories daily commits to Day One and/or text file. Improved by @DivineDominion
#!/usr/bin/env ruby
require 'time'
require 'erb'
require 'cgi'
filename = "~/.gitlogger"
## File format, One per line
# Repo Name:/path/to/base
dayone = false # log to day one? (true or false)
textlog = false # "~/Dropbox/nvALT2.2/GitLogger.md" # set to false to disable