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 | |
# merge pages from two pdf documents (same as Merge Every Other) | |
# only the two documents to be merged must be opened, the first must be the front window. | |
# this assumes a feed scanner, hence expects the second document's pages to be reversed. | |
require 'appscript' | |
include Appscript |
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 | |
pid = fork and (Process.detach(pid); exit) # Go to background. | |
require 'appscript' | |
SRC_MACRUBY_WAIT_FOR_PLAYER_NOTIFICATION = <<-RUBY | |
framework "Cocoa" | |
def playerInfo(notification); exit; end |
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 | |
require 'appscript' | |
require 'pathname' | |
include Appscript | |
### Usage: | |
# ./itunes-mk-playlist.rb \ | |
# ~/"Music/iTunes/iTunes Media/Music/Atomine Elektrine/Zektor X/09 ...and Ever.mp3" \ |
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 | |
require 'appscript' | |
require 'cgi' | |
################################################################### | |
# Copy the URLs for the selected messages in Mail to the clipboard. | |
################################################################### | |
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 runhaskell | |
(≤) = (<=) | |
(≥) = (>=) | |
(≠) = (/=) | |
(÷) = (div) | |
main = do | |
print (1 ≤ 2) | |
print (2 ≥ 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
// ## compile this with: | |
// clang \ | |
// -framework Foundation \ | |
// -framework AppKit \ | |
// -framework ApplicationServices \ | |
// -fobjc-gc-only \ | |
// -o target_browser \ | |
// target_browser.m | |
#import <Foundation/Foundation.h> |
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 | |
require 'appscript' | |
VALID_BROWSERS = %w[ WebKit Safari ] | |
# Used in my appscripts to target Safari or WebKit dynamically. | |
# Returns an Appscript::Application for one of these browsers following this priority: | |
# 1. is frontmost | |
# 2. is running and default |
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
#!/bin/bash | |
function safari { open -a Safari; } | |
function webkit { open -a WebKit; } | |
function reset { | |
killall Safari 2>/dev/null | |
killall WebKit 2>/dev/null | |
} |
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 | |
require 'fileutils' | |
require 'unicode_utils' | |
ARGV.each do |f| | |
f_ = UnicodeUtils.downcase(f) | |
f__ = "#{f_}_#{rand}" | |
FileUtils.mv(f, f__) |
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 | |
require 'yaml' | |
def ipv6?(s) | |
raise NotImplementedError | |
end | |
good, bad = YAML::load(DATA.read).values_at *%w[ GOOD BAD ] | |
results = [] |