View shellista.py
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 os, cmd, sys, re, glob, os.path, shutil, zipfile, tarfile, gzip, string, urllib2, ui | |
# Credits | |
# | |
# The python code here was written by pudquick@github | |
# | |
# License | |
# | |
# This code is released under a standard MIT license. | |
# |
View h2048.py
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Sat Jul 12 09:33:29 2014 | |
@author: henryiii | |
""" | |
import random | |
import numpy as np | |
from functools import partial |
View h2048.py
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Sat Jul 12 09:33:29 2014 | |
@author: henryiii | |
""" | |
import random | |
import numpy as np | |
import ui |
View solve-ccc-riddle.py
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 datetime, logging | |
def elapsed_datetime(start_datetime, end_datetime = datetime.datetime.now()): | |
return end_datetime - start_datetime # returns a datetime.timedelta | |
def find_day(days_on_earth, ref_datetime=datetime.datetime(2014,8,23), ref_is_start=True): | |
'''find day (datetime obj) corresponding to days_on_earth, tuple of days, hours, min, sec. | |
ref_is_start == True means ref date is start, return end date. itherwise, return start date given this end date | |
''' | |
dt=datetime.timedelta(**dict(zip(['days','hours','minutes','seconds'],days_on_earth))) |
View pipista.py
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
# pipista v2, by pudquick, updated for pythonista 1.5 by jsbain | |
# todo: consolidate unzip, ungzip, unbzip, and untar. tarfile supports compressed archives, so can use that directly. use is_zipfile, is_tarfile rather than magic packet stuff. there is a lot of duplicate code elsewhere that should be modularized | |
# 2) option to use site-packages rather than pypi-modules | |
# 3) make sure to cleanup .tmp on errors. | |
import os, os.path, sys, urllib2, requests, tempfile, zipfile, shutil, gzip, tarfile, xmlrpclib, ConfigParser | |
__pypi_base__ = os.path.abspath(os.path.dirname(__file__)) |
View reminder.py
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 notification, uuid, sys | |
def reminder(message, delay=3600*24, uid=None, | |
sound_name='default', | |
action=None, action_args=(), | |
interval=3600, | |
num_reminders=5): | |
''' call a script after a delay, and keep reminding until the notification is acknowledged. | |
uses a uid to access all instances of this reminder, for deleting or finding when the next instance is scheduled. | |
View ZoomView.py
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 | |
class Touch(object): | |
''' writable version of ui.Touch''' | |
def __init__(self,touch): | |
self.location=touch.location | |
self.touch_id=touch.touch_id | |
self.phase=touch.phase | |
self.prev_location=touch.prev_location | |
self.timestamp=touch.timestamp |
View path_edit.py
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
''' | |
useless path editor. | |
tap to add a point. tap again to add a control point. | |
then, another control point, and finally another point on the curve. | |
existing points and control points can be dragged around, to change the curve. | |
clicking save button saves an image of the path, without the handles. | |
View world.py
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
class world (object): | |
def webview_should_start_load(self,webview, url, nav_type): | |
if url.startswith('world://'): | |
print 'country selected:', urlparse.unquote(urlparse.urlparse(url).netloc) | |
return False | |
else: | |
return True | |
import ui,os | |
w=ui.WebView() |
View gistcheck.py
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
# Source: https://gist.github.com/5212628 | |
# | |
# All-purpose gist tool for Pythonista. | |
# | |
# When run directly, this script sets up four other scripts that call various | |
# functions within this file. Each of these sub-scripts are meant for use as | |
# action menu items. They are: | |
# | |
# Set Gist ID.py - Set the gist id that the current file should be | |
# associated with. |
OlderNewer