This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'net/http' | |
require 'iconv' | |
require 'optparse' | |
require 'fileutils' | |
require 'cgi' | |
$options = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Turns templated input into repeating blocks based on start and end numbers | |
# Basic syntax: `##0,5##` where 0 is start and 5 is end | |
# Modifiers may be included: `##+4##` will be replaced by the current counter plus four | |
# One start,end placeholder allowed, any number of modifers | |
# By Brett Terpstra, 2012 <http://brettterpstra.com> | |
# WTFPL License <http://en.wikipedia.org/wiki/WTFPL> | |
input = STDIN.read |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
=begin | |
PDFSearch (OSX-only[^1]) by Brett Terpstra 2012 | |
requires pdf-reader <https://github.com/yob/pdf-reader> | |
`gem install pdf-reader` | |
* Searches for the string(s) passed as arguments in PDF files located by Spotlight | |
* Quote arguments to search exact phrase, unquoted arguments are fuzzy | |
* Returns a Markdown definition list to STDOUT with links to matched files and page numbers matched | |
* Progress reported to STDERR, output can be redirected silently. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var%20inputs=document.getElementsByTagName('input'),firstSearch=false,textinputs=[],i,t;for(i=0;i<inputs.length;i++)if(((inputs[i].type==='text')||(inputs[i].type==='search'))&&inputs.disabled!==true)textinputs.push(inputs[i]);for(t=0;t<textinputs.length;t++)if((/search/i).test(textinputs[t].className)||(/(^[sq]$|search|query)/i).test(textinputs[t].id)||(/^(q(uery)?|s|.*?search.*)$/).test(textinputs[t].name)){firstSearch=textinputs[t];break;}if(!firstSearch)textinputs[0].focus();else%20firstSearch.focus(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import csv | |
import os | |
from datetime import datetime | |
import sys | |
import re | |
import urllib2 | |
expand_tco_links = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
''' | |
This script parses a text file with archived tweets and sorts them into archive files based on month | |
Original script by [Ian Beck](http://beckism.com/2012/07/archiving-tweets/) 2012 | |
This iteration by [Brett Terpstra](http://brettterpstra.com) 2012 | |
Designed to operate via Hazel or other file watcher. Reads a Dropbox file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# == Synopsis | |
# Proof of concept using Fuzzy File Finder to locate a script to edit | |
# Searches a set of predefined locations for a fuzzy string | |
# e.g. "mwp" matches both "myweatherprogram" and "mowthelawnplease" | |
# ................on "(m)y(w)eather(p)rogram" and "(m)o(w)thelawn(p)lease" | |
# | |
# Results are ranked and a menu is displayed with the most likely | |
# match at the top. Editor to be launched and directories to search |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' | |
if 0; # not running under some shell | |
use warnings; | |
use strict; | |
use File::Basename; | |
use Getopt::Long; | |
use Text::Textile qw(textile); | |
use Encode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def e_sh(str) | |
str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').gsub(/\n/, "'\n'").sub(/^$/, "''") | |
end | |
def process_post(input) | |
links = input.scan(/\((https?:\/\/([^\)]+))\)/) | |
refs = input.scan(/^\[([^^][^\]]+)\]: (.*)$/) | |
lines = input.split("\n") | |
bottom = lines[0..-1].join("\n").gsub(/^\[([^^][^\]]+)\]: .*\n?/,'') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Requires 'sequel' and 'mysql' rubygems | |
require 'rubygems' | |
require 'sequel' | |
require 'cgi' | |
def e_sql(str) | |
str.to_s.gsub(/(?=[\\])/, "\\") | |
end |