Skip to content

Instantly share code, notes, and snippets.

@tofias
tofias / Search Pinboard from Drafts
Created February 7, 2013 21:57
Search Pinboard from Drafts
drafts://x-callback-url/import_action?type=URL&name=Search%20in%20Pinboard&url=https%3A%2F%2Fm.pinboard.in%2Fsearch%2F%3Fquery%3D%5B%5Bdraft%5D%5D%26mine%3DSearch%2BMine
@tofias
tofias / applescript.py
Last active October 12, 2018 03:10
applescript.py
#!/usr/bin/python
# applescript.py v. 2014-09-18
# based on applescript.py by Dr. Drang
# http://www.leancrew.com/all-this/2013/03/combining-python-and-applescript
import subprocess
def asrun(ascript):
@tofias
tofias / mess.sh
Created October 10, 2013 22:46
For processing other things while using Marked.app (e.g., less files into a CSS custom style). Use as a preprocessing script.
#!/bin/bash
# mess.sh for processing other things while using Marked.app (VERSION 2013-10-10)
# Michael Tofias http://tofias.net
# Grab the text off of stdin
THETEXT=$(cat);
# Run any scripts you might want to run, such as less (see http://lesscss.org)
lessc $MARKED_ORIGIN/styles.less > ~/Library/Application\ Support/Marked/Custom\ CSS/styles.css;
@tofias
tofias / Open_Recent.scpt
Last active January 3, 2016 19:49
Open the Open Recent File Menu in BBEdit
-- Open the Open Recent File Menu in BBEdit
-- https://gist.github.com/tofias/8510931
-- dedicated to the good Dr Drang: http://www.leancrew.com/all-this/2014/01/open-recent-macro-for-bbedit
tell application "BBEdit"
activate
tell application "System Events"
tell process "BBEdit"
tell menu bar 1
@tofias
tofias / longURL.scpt
Last active January 2, 2016 04:39
Get the Long URL for a Short URL
-- Get the Long URL for a Short URL
-- https://gist.github.com/tofias/8252138
set theClipboard to the clipboard as string
set myScript to "curl -sIL " & theClipboard & " | grep ^[lL]ocation | awk 'END{print}' | tr '[:upper:]' '[:lower:]' | tr -d '[[:space:]]' | sed s/'location:'// | tr -d '\n' | pbcopy"
do shell script myScript
set theClipboard to the clipboard as string
#!/usr/bin/perl
# Description: http://daringfireball.net/2010/08/open_urls_in_safari_tabs
# License: See below.
# http://gist.github.com/507356
# UPDATE for "Create and run the AppleScript" portion of Gruber's original script
# http://gist.github.com/1990793
#
# UPDATE 2 for force opening in Google Chrome
@tofias
tofias / Make a BBEdit
Created February 12, 2013 22:04
Makes a new file in BBEdit using contents of clipboard.
-- Make a BBEdit
-- Michael Tofias 2013-02-12
-- https://gist.github.com/tofias/4773865
set toPaste to the clipboard as Unicode text
tell application "BBEdit"
activate
make new document
if toPaste is not "" then
@tofias
tofias / OmniFocus Filterer
Created June 28, 2012 02:43
AppleScript to toggle Active and Available in Context or Project Mode in OmniFocus
-- OmniFocus Filterer -- toggle Active and Available in Context or Project Mode.
-- Michael Tofias 2012-06-27
-- https://gist.github.com/3008488
set theList to {"1 Active and Available"}
set theList to theList & {"2 Active"}
set theList to theList & {"3 Available"}
choose from list (theList) with prompt "Choose a filter toggle:" with title "OmniFocus Filterer"
set myAnswer to result as text
@tofias
tofias / Open URLs in Safari Tabs.pl
Created March 7, 2012 03:39 — forked from gruber/Open URLs in Safari Tabs.pl
Open URLs in Tabs (an update to Gruber's instant classic perl script) see: http://log.tofias.net/scripts
#!/usr/bin/perl
# Description: http://daringfireball.net/2010/08/open_urls_in_safari_tabs
# License: See below.
# http://gist.github.com/507356
# UPDATE for "Create and run the AppleScript" portion of Gruber's original script
# http://gist.github.com/1990793
use strict;
@tofias
tofias / getDate.scpt
Created September 17, 2014 22:51
Get date the easy way with AppleScript
-- Get date the easy way with AppleScript
set theDate to do shell script "date +'%Y-%m-%d'" as string