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
View FileBrowser.py
import SimpleHTTPServer
import SocketServer
import webbrowser
import os
os.chdir('/')
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", 0), Handler)
port = httpd.server_address[1]
webbrowser.open('http://localhost:' + str(port), stop_when_done=True)
httpd.serve_forever()
View MultiScene.py
# 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.
View Shell.py
# Based on https://gist.github.com/4063716
#
# 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 ImageMail.py
# Example for sending an email with an attached image using smtplib
#
# IMPORTANT: You need to enter your email login in the main() function.
# The example is prepared for GMail, but other providers
# should be possible by changing the mail server.
import smtplib
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email import encoders
@omz
omz / install_xmlrpclib.py
Created Nov 15, 2012
install_xmlrpclib
View install_xmlrpclib.py
# install missing xmlrpclib module
import requests
r = requests.get('http://hg.python.org/cpython/raw-file/7db2a27c07be/Lib/xmlrpclib.py')
with open('xmlrpclib.py', 'w') as f:
f.write(r.text)
View New from Gist.py
### Based on: https://gist.github.com/b0644f5ed1d94bd32805
### This version strips unicode characters from the downloaded script
### to work around the currently limited unicode support of the editor
### module.
# This script downloads and opens a Gist from a URL in the clipboard.
# It's meant to be put in the editor's actions menu.
#
# It works with "raw" and "web" gist URLs, but not with gists that
# contain multiple files or non-Python files.
View Untitled 1.py
#coding: utf-8
# Original script by Federico Viticci:
# http://www.macstories.net/reviews/fantastical-for-iphone-review/
# Modified to work better with international characters
import webbrowser
import clipboard
import urllib
import console
View My Workflow 5.wkflw
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 / Add from Gist.wkflw
Created Dec 16, 2012
Imports a workflow or script from a Gist URL in the clipboard into the commands menu.
View Add from Gist.wkflw
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" : [
{
View turtle.py
# turtle.py
# Basic Turtle graphics module for Pythonista
#
# When run as a script, the classic Koch snowflake is drawn as a demo.
# The module can also be used interactively or from other scripts:
# >>> from turtle import *
# >>> right(30)
# >>> forward(100)
# ...
You can’t perform that action at this time.