Skip to content

Instantly share code, notes, and snippets.

@BenjyWiener
BenjyWiener / Swizzle.py
Created July 21, 2016 21:21
Pythonista module for swizzling methods using the Objective-C runtime.
from objc_util import *
from inspect import getargspec
c.method_setImplementation.restype = c_void_p
c.method_setImplementation.argtypes = [c_void_p, c_void_p]
c.method_getImplementation.restype = c_void_p
c.method_getImplementation.argtypes = [c_void_p]
''' Make `swizzledFunc` run instead of `method` '''
@BenjyWiener
BenjyWiener / Add Pydia Button.py
Last active March 21, 2019 16:00
Pydia Installer + Add Pydia Button
# coding: utf-8
from UIKit import *
def main():
rootVC = UIApplication.sharedApplication().keyWindow().rootViewController()
tabVC = rootVC.detailViewController()
methods = [pydiaButtonPressed]
PydiaItemController = create_objc_class('PydiaItemController', NSObject, methods = methods)
@BenjyWiener
BenjyWiener / PydiaKit.py
Created March 4, 2016 00:16
Pydia Source Code
# coding: utf-8
import sys
import os
from UIKit import *
sys.path.append(os.path.expanduser('~/Documents/site-packages/Pydia/Pydia Supporting Files/'))
import Pydia_Sources
import Pydia_Package
@BenjyWiener
BenjyWiener / Add Screen Recorder Button.py
Last active September 15, 2017 08:06
Screen recorder for Pythonista
# coding: utf-8
from objc_util import *
from ReplayKit import *
from console import alert
import ui
UIBarButtonItem = ObjCClass('UIBarButtonItem')
def main():
@BenjyWiener
BenjyWiener / ShowTouches.py
Last active February 28, 2016 17:22
Module for highlighting touches within Pythonista.
# coding: utf-8
from objc_util import *
from UIKit import *
from Foundation import *
def __setup():
global __show_touches_setup_complete
try:
return __show_touches_setup_complete
@BenjyWiener
BenjyWiener / ReplayKit.py
Last active September 7, 2017 04:34
ReplayKit.py
# coding: utf-8
from objc_util import *
from Foundation import NSBundle
NSBundle.bundleWithPath_('/System/Library/Frameworks/ReplayKit.framework').load()
RPScreenRecorder = ObjCClass('RPScreenRecorder')
@BenjyWiener
BenjyWiener / local_authentication.py
Created January 29, 2016 17:53
LocalAuthentication for Pyhtonista
# coding: utf-8
from objc_util import *
import time
def authenticate(reason = ' '):
ObjCClass('NSBundle').bundleWithPath_('/System/Library/Frameworks/LocalAuthentication.framework').load()
context = ObjCClass('LAContext').alloc().init()
global result
result = None