This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" : [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" : [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
# ... |