Here is a neat trick on how to access OS X pasteboard services with Ruby or any other shell script. It is based on pbcopy and pbpaste:
Reverse string in clipboard:
s = IO.popen('pbpaste', 'r+').read IO.popen('pbcopy', 'w').puts s.reverse
Generate html syntax highlighting using Syntax:
require 'rubygems' require 'syntax/convertors/html'convertor = Syntax::Convertors::HTML.for_syntax “ruby”
html = convertor.convert(IO.popen('pbpaste', 'r+').read)
IO.popen('pbcopy', 'r+').puts html
Gotta love Mac OS X!