Skip to content

Instantly share code, notes, and snippets.

Avatar

Steven Troughton-Smith steventroughtonsmith

View GitHub Profile
View gist:62f0b14d5ef532a4be2e2529187c100d
call ((NSWindow *)[(NSArray *)[[NSApplication sharedApplication] windows] lastObject]).collectionBehavior = 1<<7|1<<8|1<<11
@steventroughtonsmith
steventroughtonsmith / DrawingKit.swift
Created Sep 16, 2016
DrawingKit playground for iOS 10
View DrawingKit.swift
import PlaygroundSupport
import Foundation
import UIKit
Bundle(path: "/System/Library/PrivateFrameworks/DrawingKit.framework")?.load()
let DKInkView = NSClassFromString("DKInkView") as! UIView.Type
extension UIView {
func newGPUAvailable() -> Bool {
@steventroughtonsmith
steventroughtonsmith / main.m
Created Mar 24, 2016
Load Mach-O executable at runtime and execute its entry point
View main.m
void callEntryPointOfImage(char *path, int argc, char **argv)
{
void *handle;
int (*binary_main)(int binary_argc, char **binary_argv);
char *error;
int err = 0;
printf("Loading %s\n", path);
handle = dlopen (path, RTLD_LAZY);
View gist:52f0c6783446b6fc536e
AddressBookUI.framework
(
"com.apple.people-picker"
)
AudioToolbox.framework
(
"com.apple.AudioUnit",
"com.apple.AudioUnit-UI"
@steventroughtonsmith
steventroughtonsmith / Show Tab Overview.py
Last active Nov 4, 2020
'Show Tab Overview' script for Pythonista - adds button to toolbar to show tab overview
View Show Tab Overview.py
# coding: utf-8
from objc_util import *
UIApplication = ObjCClass('UIApplication')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
@on_main_thread
def main():
rootVC = UIApplication.sharedApplication().keyWindow().rootViewController()
@steventroughtonsmith
steventroughtonsmith / FileBrowser.py
Created Jan 14, 2016
File Browser for Pythonista
View FileBrowser.py
# coding: utf-8
from UIKit import *
from Foundation import *
from ctypes import *
libobjc = CDLL('/usr/lib/libobjc.dylib')
QLPreviewController = ObjCClass('QLPreviewController')
@steventroughtonsmith
steventroughtonsmith / Add Web Tab.py
Created Jan 13, 2016
Insert a custom browser tab into Pythonista
View Add Web Tab.py
# coding: utf-8
from Foundation import *
from QuartzCore import *
from UIKit import *
import console
WKWebView = ObjCClass('WKWebView')
@on_main_thread
@steventroughtonsmith
steventroughtonsmith / Foundation.py
Last active Nov 1, 2020
UIKit+UIFoundation & Foundation for Pythonista - autoconverted from SDK tbd (includes non-public SPI)
View Foundation.py
# coding: utf-8
from objc_util import *
NSAKDeserializer = ObjCClass('NSAKDeserializer')
NSAKDeserializerStream = ObjCClass('NSAKDeserializerStream')
NSAKSerializer = ObjCClass('NSAKSerializer')
NSAKSerializerStream = ObjCClass('NSAKSerializerStream')
NSAbstractLayoutGuide = ObjCClass('NSAbstractLayoutGuide')
NSAddressCheckingResult = ObjCClass('NSAddressCheckingResult')
NSAffineTransform = ObjCClass('NSAffineTransform')
@steventroughtonsmith
steventroughtonsmith / charts.html
Last active Nov 1, 2015
AppleTV App Store Charts US Nov 1 2015
View charts.html
<head><style>table {margin: -10px} img {width: 160px; height:96px; margin: 5px; border-radius: 15px;}</style></head><body bgColor=lightgrey></body><h3> Paid Apps</h3><p><table width="600" bgcolor="lightgrey"><tbody><tr><td width="50">1)</td><td width="160"><p><img src="http://is1.mzstatic.com/image/thumb/Purple69/v4/29/14/9b/29149b9c-4942-6f61-de71-cb4110559126/source/320x192bb.jpg"></p></td><td>$9.99 <a href="https://itunes.apple.com/us/app/beat-sports/id1044337747?mt=8">Beat Sports</a><p>★★★★✩</p></td></tr></tbody></table></p><p><table width="600" bgcolor="#bdbdbd"><tbody><tr><td width="50">2)</td><td width="160"><p><img src="http://is2.mzstatic.com/image/thumb/Purple69/v4/c2/17/7d/c2177d04-ad91-5fc3-1d68-4b378a2ba46b/source/320x192bb.jpg"></p></td><td>$2.99 <a href="https://itunes.apple.com/us/app/simplex-for-plex/id1049324561?mt=8">SimpleX - for Plex</a><p>★★★✩✩</p></td></tr></tbody></table></p><p><table width="600" bgcolor="lightgrey"><tbody><tr><td width="50">3)</td><td width="160"><p><img src="http://
@steventroughtonsmith
steventroughtonsmith / gist:6788b6c340a0aa52345a
Created Oct 27, 2015
Run OS X Screen Saver as Wallpaper
View gist:6788b6c340a0aa52345a
/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background
You can’t perform that action at this time.