Skip to content

Instantly share code, notes, and snippets.

@macdrifter
macdrifter / get_links.py
Created October 18, 2012 22:53
get_links
@macdrifter
macdrifter / formd-pythonista.py
Created October 18, 2012 00:16 — forked from ttscoff/formd-pythonista.py
A modified version of formd for use with Pythonista on iOS
# encoding=utf8
"""
formd by Seth Brown, 02-24-12
modified for iOS use (Pythonista) by Brett Terpstra, 10-17-12
"""
from sys import stdin, stdout
import clipboard
import re
from collections import OrderedDict
{
"actions" : [
{
"class" : "WorkflowActionRequestTextInput",
"parameters" : {
"multiLineOption" : 1,
"title" : "Append to Scratch"
}
},
{
@macdrifter
macdrifter / 7DADBAF5-352B-498A-8A2D-E15C2A5EDDE8.wkflw
Created February 8, 2013 12:33
Editorial workflow to insert reference link
This gist contains a workflow for Editorial, an app for
writing plain text and markdown on iOS.
To import the workflow, copy the *entire* text of the gist,
then open Editorial and create a new workflow.
------------ BEGIN WORKFLOW ------------
{
"actions" : [
{
@macdrifter
macdrifter / stringParser.py
Created August 15, 2013 13:57
stringParser
import sys
import re
import urllib
import clipboard
def titleCase(s):
newText = re.sub(r"[A-Za-z]+('[A-Za-z]+)?",lambda mo: mo.group(0)[0].upper() + mo.group(0)[1:].lower(),s)
return newText
print "Convert to:"
@macdrifter
macdrifter / PDFMerge.scpt
Created March 2, 2010 03:20
AppleScript that calls the python code buried in an automator action. This is example code for use with Devonthink Office Pro. The script should combine to PDF's into one new original
(* AppleScript that calls the python code buried in an automator action. This is example code for use with Devonthink Office Pro. The script should combine to PDF's into one new original *)
try
set myScript to "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -- Path to the python script
set sourceOne to "/Path/To/First/PDF/myFile.PDF" -- First PDF
set sourceTwo to "/Path/To/Second/PDF/myFile.PDF" -- Second PDF
set myDestination to "~/final.pdf" -- The new file
@macdrifter
macdrifter / available_tasks.py
Last active May 27, 2018 05:11
Sublime Text function to display available tasks from a TaskPaper file. Looks for @start, @Due and @started tags with dates before today's date
import sublime, sublime_plugin
import re
import time
class AvailableTasksCommand(sublime_plugin.TextCommand):
def run(self, edit):
today_date = time.strftime('%Y-%m-%d')
self.available_marker = []
@macdrifter
macdrifter / CsvToArray.py
Created December 8, 2012 12:01 — forked from tony-landis/CsvToArray.py
Convert CSV string to fixed width text table
"""
Convert CSV string to fixed width text table. Supports multi-line rows, column width limits, and creates a header row automatically
@author Tony Landis
@link http://www.tonylandis.com
@license GPL
"""
from math import ceil
class CsvToTxt():
@macdrifter
macdrifter / DropboxSync.py
Created November 13, 2012 22:46 — forked from wrenoud/DropboxSync.py
DropboxSync
import os
import sys
import pickle
import console
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
sys.path += [os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')]
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
https://itunes.apple.com/us/app/sql-ed/id475312085?mt=8