Skip to content

Instantly share code, notes, and snippets.

Ole Zorn omz

Block or report user

Report or block omz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
omz / Color
Created Feb 7, 2015
View Color
import ui
from random import randint
import console
import clipboard
# Generate some random hex colors:
colors = ['#%X%X%X' % (randint(0,255), randint(0,255), randint(0,255)) for i in xrange(25)]
def tapped(sender):
r, g, b, a = sender.background_color
hex_color = '#%X%X%X' % (int(r*255), int(g*255), int(b*255))
omz /
Created Apr 23, 2015
# coding: utf-8
# Starting point for emailing a group of people via Dispatch...
# The people in the group are identified by a unique string in the Notes field.
# TODO: Support setting the group identifier with an argument when launching the script via URL scheme (LCP...) - subject, body etc. could also be passed as arguments.
# Change this:
group_note = 'Group1'
omz / Mask
Created Jul 19, 2015
View Mask
# Minimal example for ui.Image.clip_to_mask
# Note: Due to the changed image names, this requires Pythonista 1.6 (beta), but it could work in 1.5bwith different image names.
import ui
with ui.ImageContext(256, 256) as ctx:
mask_img = ui.Image.named('iow:beaker_256')
img = ui.Image.named('test:Peppers')
# Utility functions for setting UI/syntax highlighting theme in Pythonista (1.6 beta) using objc_util. WARNING: This relies on some internals that may change in the future.
# When run as a script, it toggles between the default (light) theme and Tomorrow-Dark.
from objc_util import *
import os
import glob
def get_theme_names():
res_path = str(ObjCClass('NSBundle').mainBundle().resourcePath())
theme_paths = glob.glob(os.path.join(res_path, 'Themes2/*.json'))
omz / gist:2134449
Created Mar 20, 2012
Highlighter plain text format
View gist:2134449
p. 4 | highlight | yellow
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
# Quick-and-dirty demo of how to run multiple scenes
# in Pythonista; The MultiScene class is basically a
# wrapper for another scene and forwards all events
# to the currently-active scene, which can be changed
# with the switch_scene method.
# In this example, the first scene simply draws a red
# background and switches to the second scene when a
# touch is detected. The second scene draws a green
# background and plays a beep sound on touch.
# Based on
# Provides a simple shell with basic
# commands for dealing with files and
# directories.
# This script will try and prevent
# unsafe file operations outside of
# Documents directory.
View Untitled
#coding: utf-8
# Original script by Federico Viticci:
# Modified to work better with international characters
import webbrowser
import clipboard
import urllib
import console
omz /
Created Jun 28, 2014
import ui
# Mapping based on
CHARMAP = {'!': '\xc2\xa1', '"': ',,',
"'": ',', '&': '\xe2\x85\x8b',
')': '(', '(': ')', ',': "'",
'.': '\xcb\x99',
'1': '\xc6\x96',
'0': '0', '3': '\xc6\x90',
'2': '\xe1\x84\x85',
View Touch
# 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):
You can’t perform that action at this time.