Skip to content

Instantly share code, notes, and snippets.

@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 / 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
@tofias
tofias / User CSS for Feedbin
Last active August 29, 2015 14:05
User CSS for Feedbin
/* User CSS for Feedbin - Michael Tofias - 2014-08-22 */
/* Feedbin is great, check it out: https://feedbin.com
But it's even better with three-shoved-into-two-columns
when in a portrait orientation. */
@media all and (min-width: 767px) and (min-height: 900px){
.entry-header h1 {
font-size: 130% !important;
@tofias
tofias / Hipster Ipsum
Created February 22, 2014 19:22
Hipster Ipsum for Alfred (or similar)
#!/usr/bin/php
# Hipster Ipsum for Alfred
# https://gist.github.com/tofias/9160634
# using hipsteripsum.me (via API at hipsterjesus.com)
# based on https://github.com/sethlilly/Hipster-Ipsum-for-Coda
$COUNT = 1; # number of paragraphs 1-99
$HTML = "false"; # or 'true'
$TYPE = "hipster-centric"; # or 'hipster-latin'
@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
@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;
#!/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 / 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