This file contains 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
ply_url = 'https://pypi.python.org/packages/source/p/ply/ply-3.4.tar.gz' | |
slimit_url = 'https://pypi.python.org/packages/source/s/slimit/slimit-0.8.1.zip' | |
print 'Downloading SlimIt...' | |
from urllib import urlretrieve | |
import tarfile | |
import zipfile | |
import shutil | |
import os | |
try: |
This file contains 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 script adds a "Webclip" shortcut to your homescreen. | |
# The shortcut can be used to open a web page in full-screen mode, | |
# or to launch a custom URL (e.g. a third-party app). | |
# You'll be asked for a title, a URL, and an icon (from your camera roll) | |
import plistlib | |
import BaseHTTPServer | |
import webbrowser | |
import uuid | |
from io import BytesIO |
This file contains 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 console | |
import clipboard | |
import os | |
img = clipboard.get_image() | |
if img: | |
img.save('temp.jpg') | |
console.quicklook('temp.jpg') | |
os.remove('temp.jpg') | |
else: |
This file contains 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
# Shows the location of the last photo in the canera roll in the Maps app. | |
# (thanks to @HyShai for pointing out that the latitude/longitude refs are necessary) | |
import photos | |
import webbrowser | |
meta = photos.get_metadata(-1) | |
gps = meta.get('{GPS}') | |
if gps: | |
latitude = str(gps.get('Latitude', 0.0)) + gps.get('LatitudeRef', '') |
This file contains 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
# FontInstaller (by @olemoritz) | |
# This script installs a custom TTF font on iOS (system-wide). | |
# It can be used in one of two ways: | |
# 1. Simply run it in Pythonista, you'll be prompted for the URL of the font | |
# you'd like to install (if there's a URL in the clipboard, it'll be used by default) | |
# 2. Use it as an 'Open in...' handler, i.e. select this file in Pythonista's 'Open in... | |
# menu' setting. This way, you can simply download a ttf file in Safari and open it in |
This file contains 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
# Simple demo of playing a looping sound using the (currently undocumented) sound.Player class | |
import sound | |
import os | |
from scene import * | |
class MyScene (Scene): | |
def setup(self): | |
self.player = sound.Player(os.path.expanduser('~/Pythonista.app/Beep.caf')) | |
self.player.number_of_loops = -1 #repeat forever |
This file contains 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
# IMPORTANT SETUP INSTRUCTIONS: | |
# | |
# 1. Go to http://www.dropbox.com/developers/apps (log in if necessary) | |
# 2. Select "Create App" | |
# 3. Select the following settings: | |
# * "Dropbox API app" | |
# * "Files and datastores" | |
# * "(No) My app needs access to files already on Dropbox" | |
# * "All file types" | |
# * (Choose any app name) |
This file contains 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 ui | |
# Mapping based on http://www.upsidedowntext.com/unicode | |
CHARMAP = {'!': '\xc2\xa1', '"': ',,', | |
"'": ',', '&': '\xe2\x85\x8b', | |
')': '(', '(': ')', ',': "'", | |
'.': '\xcb\x99', | |
'1': '\xc6\x96', | |
'0': '0', '3': '\xc6\x90', | |
'2': '\xe1\x84\x85', |
This file contains 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
/* | |
Batch-Rename Layers -- plugin for Sketch 2 (http://www.bohemiancoding.com/sketch/) | |
INSTALLATION | |
------------ | |
Select "Reveal Plugins Folder..." in the "Plugins" menu, | |
then put this file in the folder that shows up in the Finder. |
This file contains 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
# Very simple SSH client for Pythonista | |
import paramiko | |
import console | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
host = console.input_alert('Connect to') | |
user, passwd = console.login_alert('Login') | |
ssh.connect(host, username=user, password=passwd) | |
print 'Connected to %s. Type `exit` to disconnect.' % host |