I figured I’d toss this out in the event that someone has a better solution in hand. I tossed this together quickly and it works. It requires that you have Pygments installed and pygmentize on your path (which is silly, because I could have just imported pygments as a library…) It also requires that Safari is running. But, hey, it works.
import os
import sys
def go():
if len(sys.argv) != 2:
print "Usage: %s <filename>" % sys.argv[0]
sys.exit(1)
output_fn, ext = os.path.splitext(sys.argv[1])
output_fn += '.html'
print "Generating %s" % (output_fn)
os.system("pygmentize -O full -o %s %s" % (output_fn, sys.argv[1]))
print "Copying to clipboard..."
fullpath = os.path.abspath(output_fn)
os.system("""osascript<<END
tell application "Safari"
activate
make new document at end of documents
set url of document 1 to "file://%s"
end tell
tell application "System Events"
tell process "Safari"
click menu item "Select All" of menu "Edit" of menu bar 1
click menu item "Copy" of menu "Edit" of menu bar 1
click menu item "Close Window" of menu "File" of menu bar 1
end tell
end tell
END
""" % (fullpath))
if __name__ == "__main__":
go()
It’s kind of a weird thing to want to do, but I’d like to be able to “flip” the screen image on one of my displays on my Mac, in real time. The Mac lets you rotate the image (in 90 degree increments), but there is no way to make it like an image seen in a mirror. Does anyone know of software that lets you do that?
opensource: del.icio.us tag/opensource
OS
Software
linux
desktop
opensource
technology
freeSoftware
open-source: del.icio.us tag/open-source
OS
Software
linux
desktop
opensource
technology
freeSoftware