Skip to content

Instantly share code, notes, and snippets.

View ttscoff's full-sized avatar
💭
Breathing

Brett Terpstra ttscoff

💭
Breathing
View GitHub Profile
- Media
- Movies
* Objectified
* Down by Law
* Safety Not Guaranteed
* Warm Bodies
- Books
- Magazines
@ttscoff
ttscoff / a.rb
Created March 13, 2013 22:53
paste this into Curio
- Media
- Movies
* Objectified
* Down by Law
* Safety Not Guaranteed
* Warm Bodies
- Books
- Magazines
@ttscoff
ttscoff / chgext.sh
Created March 14, 2013 00:08
One-line Bash command to change the extensions of all files in a directory
# batch change extension
chgext() {
for file in *.$1 ; do mv $file `echo $file | sed "s/\(.*\.\)$1/\1$2/"` ; done
}
alias pbgist="jist -Ppo"
@ttscoff
ttscoff / a.rb
Last active February 20, 2025 09:58
# updated per Lri's comment
alias psgrep="ps -Aco pid,comm | sed 's/^ *//'| sed 's/:/ /'|grep -iE"
@ttscoff
ttscoff / a.rb
Last active February 20, 2025 09:58
# batch change extension (fix from Lri, again)
chgext() {
for file in *.$1 ; do mv "$file" "${file%.$1}.$2" ; done
}
# Select the current directory in launchbar, optionally a file
lb () {
if [[ $# = 1 ]]; then
[[ -e "$(pwd)/$1" ]] && open "x-launchbar:select?file=$(pwd)/$1" || open "x-launchbar:select?file=$1"
else
open "x-launchbar:select?file=$(pwd)"
fi
}
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
@ttscoff
ttscoff / gist:5186815
Created March 18, 2013 12:24
Mathjax CDN embed, put this before the `</head>` tag.
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
@ttscoff
ttscoff / zemanta.rb
Created March 23, 2013 11:13
Rakefile task for querying Zemanta for keywords
require 'yaml'
require 'rubygems'
require 'zemanta' # gem install zemanta
def get_zemanta_terms(content)
$stderr.puts "Querying Zemanta..."
zemanta = Zemanta.new "xxxxxxxxxxxxxxxxxxxxxxxx"
suggests = zemanta.suggest(content)
res = []
suggests['keywords'].each {|k|