Skip to content

Instantly share code, notes, and snippets.

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" : [
{
@omz
omz / Evernote Installer.py
Created February 27, 2013 15:07
Evernote Installer
# Simple installer script for using the Evernote SDK in Pythonista
#
# This script should be run from the root directory. In order to keep things
# tidy, it installs the module and all its dependencies in a directory named
# 'evernote-sdk'. In order to be able to import it, you have to add that to
# your import path, like this:
#
# import sys
# sys.path.append('evernote-sdk')
#
@omz
omz / Evernote Demo.py
Created February 27, 2013 15:08
Evernote Demo
# A simple Evernote API demo script that lists all notebooks in the user's
# account and creates a simple test note in the default notebook.
#
# Before running this sample, you must fill in your Evernote developer token!
#
# This sample is part of the Evernote SDK and has been modified slightly for
# Pythonista, to take advantage of the clipboard and PIL modules.
# If there is an image in the clipboard when the script is run, it is attached
# to the sample note.
@omz
omz / Touch Colors.py
Created February 28, 2013 15:00
Touch Colors
# Variation of the 'Basic Scene' template that shows every
# touch in a different (random) color that stays the same
# for the duration of the touch.
from scene import *
from colorsys import hsv_to_rgb
from random import random
class TouchColors (Scene):
def setup(self):
@omz
omz / DoubleTap.py
Created February 28, 2013 20:48
DoubleTap
from scene import *
from time import time
import sound
MAX_DOUBLE_TAP_DELAY = 0.25
class DoubleTapScene (Scene):
def setup(self):
self.last_touch_up_time = 0
self.double_tap_start_time = 0
@omz
omz / Primes.py
Created March 3, 2013 15:48
Primes
# Demo of how to generate a list of prime numbers and cache them
# in a data file for fast access (using the marshal module).
def gen_primes(n):
# Source: http://code.activestate.com/recipes/366178-a-fast-prime-number-list-generator/#c19
s = range(0, n+1)
s[1] = 0
bottom = 2
top = n // bottom
while (bottom * bottom <= n):
@omz
omz / Curve Demo.py
Created March 5, 2013 02:30
Curve Demo
import canvas
canvas.set_size(512, 512)
from_point = (10, 10)
cp1 = (40, 200) #control point 1
cp2 = (350, 50) #control point 2
to_point = (300, 300)
# Draw the actual curve:
@omz
omz / ShortURL.py
Created May 17, 2013 04:17
ShortURL
# Simple URL shortener using is.gd
#
# Save this script as 'ShortURL' in Pythonista and add the
# bookmarklet below to Safari. The result is copied to the clipboard.
# Bookmarklet:
# javascript:window.location.href='pythonista://ShortURL?action=run&argv='+encodeURIComponent(window.location.href);
import clipboard
import re
@omz
omz / iTC Downloader.py
Created July 29, 2013 23:35
iTC Downloader
# -*- coding: utf-8 -*-
# iTC Sales Report Downloader
# When you run this for the first time, you'll need to enter your
# iTunes Connect login and vendor ID. You can find the vendor ID
# on the iTunes Connect website by navigating to "Sales and Trends";
# it's the number next to your name (top-left).
CURRENCY = 'EUR'
RESET_LOGIN = False # Set to True to remove login from keychain
@omz
omz / glassboard2json.py
Created September 23, 2013 18:29
Simple converter script to get machine-readable JSON from a Glassboard HTML export
#!/usr/bin/env python
"""
This script converts a Glassboard HTML archive to JSON.
Usage:
python glassboard2json.py glassboard_export/index.html -o output_file.json
Requirement: BeautifulSoup4 (bs4)