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 'time' | |
require 'erb' | |
require 'rubygems' | |
require 'json' | |
user = 'ttscoff' | |
dayone = true # log to day one? (true or 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/ruby | |
# finished: a quick script to notify you when a command is done using Mountain Lion notifications | |
# It grabs the current folder as the title and takes one argument as the message | |
# Example: make && make install && finished "Done compiling" || finished "compiler failed" | |
# | |
# Needs the terminal-notifier gem : `gem install terminal-notifier` | |
# Can alternately be used with the CLI <https://github.com/alloy/terminal-notifier> | |
# (remove require block below and swap comment lines at the bottom) | |
require 'rubygems' |
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
bid() { | |
local shortname location | |
# combine all args as regex | |
# (and remove ".app" from the end if it exists due to autocomplete) | |
shortname=$(echo "${@%%.app}"|sed 's/ /.*/g') | |
# if the file is a full match in apps folder, roll with it | |
if [ -d "/Applications/$shortname.app" ]; then | |
location="/Applications/$shortname.app" | |
else # otherwise, start searching |
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 | |
# Requires the terminal-notifier gem ([sudo] gem install terminal-notifier) | |
# growlnotify wrapper to turn Growl alerts into Mountain Lion notifications | |
# Uses growlnotify option syntax to keep your old scripts working with the new shiny. | |
# | |
# If you use Growl via growlnotify in your shell scripting, this script | |
# will replace Growl's alerts with Mountain Lion notifications. |
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
// > defaults write -g NSTextKillRingSize -string 6 | |
// replace yank: command with yankAndSelect for use with the kill ring | |
"^y" = (yankAndSelect:); |
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
alias rmdbc="find . -name *\ \(*conflicted* -exec rm {} \;" # recursively delete Dropbox conflicted files | |
# and/or (smart idea from Gordon Fontenot) | |
alias rmdbcsafe="find . -name *\ \(*conflicted* -exec mv {} ~/DropboxConflicts/ \;" # recursively move Dropbox conflicted files to temp folder | |
# or... via TJ Luoma | |
alias rmdbctrash="find . -name *\ \(*conflicted* -exec mv -v {} ~/.Trash/ \;" # recursively move Dropbox conflicted files to Trash | |
# More advanced idea combining ideas from @modernscientist and @GFontenot would be | |
# Hazel or launchd script to move conflicted files to temp folder once a day, and Hazel or launchd script to delete files older than [x] | |
# Or schedule TJ's idea of moving to Trash and skipping intermediate folder while still maintaining the ability to review | |
# hmmmm... |
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
require 'net/http' | |
# in the main tweet parser. tweet_text is the status.text string | |
# match short campl.us urls: | |
if tweet_text =~ /\((http:\/\/campl.us\/\w+?)\)/ | |
picurl = $1 | |
# grab the source and parse out the full size image url | |
final_url = get_body(picurl).match(/"(http:\/\/pics.campl.us\/f\/c\/.+?)"/) | |
return false if final_url.nil? |
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
The standard CGI environmental variables are available as read-only attributes of a CGI object. The following is a list of these variables: | |
AUTH_TYPE HTTP_HOST REMOTE_IDENT | |
CONTENT_LENGTH HTTP_NEGOTIATE REMOTE_USER | |
CONTENT_TYPE HTTP_PRAGMA REQUEST_METHOD | |
GATEWAY_INTERFACE HTTP_REFERER SCRIPT_NAME | |
HTTP_ACCEPT HTTP_USER_AGENT SERVER_NAME | |
HTTP_ACCEPT_CHARSET PATH_INFO SERVER_PORT | |
HTTP_ACCEPT_ENCODING PATH_TRANSLATED SERVER_PROTOCOL | |
HTTP_ACCEPT_LANGUAGE QUERY_STRING SERVER_SOFTWARE |
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
#import <Carbon/Carbon.h> | |
// `keys` utility for checking whether a modifier key is held | |
// From <http://lists.apple.com/archives/applescript-users/2009/Sep/msg00374.html> | |
// | |
// $ clang keys.m -framework Carbon -o keys | |
int main (int argc, const char * argv[]) { | |
unsigned int modifiers = GetCurrentKeyModifiers(); | |
if (argc == 1) |
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
-- Launch All in Dock.applescript | |
-- Brett Terpstra 2012 | |
-- | |
-- Modified version of an AppleScript to launch all | |
-- persistent (Keep in Dock) apps[^1]. Allows you to exclude | |
-- apps based on modifier keys held when it runs. | |
-- | |
-- Uses the `keys` utility found on the Apple Mailing Lists[^2]. | |