Skip to content

Instantly share code, notes, and snippets.

@macolyte
macolyte / OpenInMarked.scpt
Created September 19, 2011 20:45
Open Byword markdown file in Marked
tell application "Byword"
set theDocument to file of document of window 1
end tell
tell application "Marked"
open theDocument
end tell
@macolyte
macolyte / get_cover_images.py
Created September 19, 2011 21:56
Batch download cover images from Amazon
#!/usr/bin/python
import shlex, subprocess
import os, os.path
import sys
import time
import argparse
FILE_NAME = 'amazon.txt'
IMAGE_PATH = '~/Documents/BookImages/'
@macolyte
macolyte / import_to_evernote.scpt
Created November 15, 2011 00:12
Import files into Evernote
on open dropped_item
set file_list to items of dropped_item
repeat with a_file in file_list
tell application "Finder" to set c_date to creation date of a_file
tell application "Evernote" to create note from file a_file notebook Text_Notes created c_date
end repeat
end open
@macolyte
macolyte / safari-image.scpt
Created November 25, 2011 18:02
Grab Amazon Cover Image - Safari
set theURL to "http://images.amazon.com/images/P/" & (the clipboard) & ".01.LZZZZZZZ.jpg"
tell application "Safari"
set URL of current tab to theURL
end tell
@macolyte
macolyte / chrome-image.scpt
Created November 25, 2011 18:04
Grab Amazon Cover Image - Chrome
set theURL to "http://images.amazon.com/images/P/" & (the clipboard) & ".01.LZZZZZZZ.jpg"
tell application "Google Chrome"
set URL of last tab of window 1 totheURL
end tell
@macolyte
macolyte / evernote_daily_log.scpt
Created November 30, 2011 02:33
Evernote Log LaunchBar Action
on handle_string(the_text)
set time_string to do shell script "date '+%H:%M:%S'"
set date_string to do shell script "date '+%Y-%m-%d'"
set message to "<p><b>" & time_string & "</b> | " & the_text & "</p>"
tell application "Evernote"
set matches to find notes (date_string as text) & " notebook:Log"
if (count of matches) is 1 then
set the_note to item 1 of matches
@macolyte
macolyte / Evernote Quick Search.scpt
Created December 13, 2011 13:28
Evernote Quick Search LaunchBar Action
on handle_string(search_query)
tell application "Evernote"
open collection window with query string (search_query as text)
activate
end tell
end handle_string
import os, subprocess
desc = []
c_line = "man 1 %s | col -b > /tmp/man.txt"
s_line = "cat /tmp/man.txt | sed -n -e \"/^NAME/,/^SYNOPSIS/ p\" | grep -v -e \"^[A-Z]\""
dirs = ["/usr/bin/", "/usr/sbin/"]
for dir in dirs:
    for f in os.listdir(dir):
@macolyte
macolyte / send_to_marsedit.scpt
Created January 17, 2012 15:28
Send to MarsEdit from Evernote
tell application "Evernote"
synchronize
set the_Selection to selection
set the_Title to title of (item 1 of the_Selection)
set the_HTML to HTML content of (item 1 of the_Selection)
set the_Text to do shell script "echo " & quoted form of the_HTML & space & "| textutil -convert txt -stdin -stdout"
set the_Tags to {}
@macolyte
macolyte / Instant_Safari_Porn_Mode.scpt
Created March 14, 2012 21:31
Instant Safari Porn Mode
tell application "Safari" to set theURL to URL of current tab of window 1
if theURL contains "some unique part of your URL" then
tellapplication "Safari"
closecurrent tab ofwindow1
endtell
set_private_browsing()
else
set_private_browsing()
tellapplication "Safari"
makenew tabinwindow1