Skip to content

Instantly share code, notes, and snippets.

View wgaylord's full-sized avatar

William Gaylord wgaylord

View GitHub Profile
@controversial
controversial / ProgressBadge.py
Last active July 19, 2022 19:31
ProgressBadge.py
from objc_util import *
import time
import notification
APP=UIApplication.sharedApplication()
DISPLAYMODE=0
def setBadge(text):
APP.setApplicationBadgeString_(text)
@omz
omz / Add Web Tab.py
Last active April 15, 2025 01:31 — forked from steventroughtonsmith/Add Web Tab.py
Insert a custom browser tab into Pythonista
# coding: utf-8
from objc_util import *
import console
import urllib
import dialogs
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
NSURLRequest = ObjCClass('NSURLRequest')
@AbrarSyed
AbrarSyed / build.gradle
Created October 28, 2015 15:22
tweaker-server example
plugins {
id "net.minecraftforge.gradle.tweaker-server" version "2.0.2"
}
version = "1.0"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"
minecraft {
version = "1.8"
@omz
omz / PythonistaBackup.py
Last active January 6, 2024 05:44
PythonistaBackup.py
# coding: utf-8
'''Creates a zip archive of your Pythonista files and serves them via HTTP in your local network.'''
import sys
if sys.version_info[0] >= 3:
from http.server import SimpleHTTPRequestHandler, HTTPServer
else:
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
@pudquick
pudquick / lzma_decompress.py
Created April 8, 2015 21:47
Python ctypes wrapper around liblzma for the purposes of (naive) lzma file decompression, for use with OS X 10.7+
# Example usage of the function:
# decompress('somefile.pack.lzma', 'somefile.pack')
# Decompresses a lzma compressed file from the first input file path to the second output file path
import sys
from ctypes import CDLL, Structure, c_void_p, c_size_t, c_uint, c_uint32, c_uint64, create_string_buffer, addressof, sizeof, byref
class lzma_stream(Structure):
_fields_ = [
@omz
omz / FontInstaller.py
Last active January 31, 2025 20:34
FontInstaller
# 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
@fiorix
fiorix / gist:9664255
Created March 20, 2014 13:55
Go multicast example
package main
import (
"encoding/hex"
"log"
"net"
"time"
)
const (
@cclauss
cclauss / getColor.py
Last active August 8, 2023 14:43
Creates a dict of 752 Pythonista scene.Colors from the tkinter color palette. This allow you to get colors like: 'light goldenrod yellow', 'light steel blue', 'SlateGray4', 'etc. I would recommend using this code to find the colors that work for your app and then hardcoding them into you app. Loading all 752 colors every time your app runs will …
import bs4, collections, console, requests, scene
tkColorDict = collections.OrderedDict() # key = tkinter color name
def loadTkColorDict(): # will automaticly be called by getColor() if needed
tkColorURL = 'http://www.tcl.tk/man/tcl8.6/TkCmd/colors.htm'
print('Loading tkinter colors from: ' + tkColorURL)
tkColorSoup = bs4.BeautifulSoup(requests.get(tkColorURL).text).tbody
print('Soup is ready. Creating color table...')
for tableRow in tkColorSoup.find_all('tr'):
@pudquick
pudquick / transtor.py
Created November 24, 2013 01:30
A Pythonista (python on iOS, check the App Store!) script for downloading torrents, modifying them, then uploading them to a Transmission server - directly from your iPhone / iPad
# Usage of this file:
# This code is intended for use in the iOS python interpreter named 'Pythonista'.
# When looking at a page on the torrentz.eu search engine for a torrent result from Mobile Safari
# you can click on a bookmarklet (mentioned below) and it will cause the following:
# - Search results for the page are scraped
# - Torrent sites are visited for direct download links for the .torrent file
# - A .torrent file is downloaded
# - The .torrent file trackers are updated to include the scraped trackers listed on torrentz.eu
# - The .torrent file is re-uploaded to your Dropbox account (for an on-demand HTTP source)
# - The direct download link for the modified .torrent file is passed via RPC to a Transmission torrent server
@omz
omz / SlimIt-Installer.py
Created October 21, 2013 17:11
SlimIt-Installer
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: