This file contains hidden or 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 | |
| from ctypes import py_object | |
| from objc_util import * | |
| import sys | |
| from objc_classes import objcmethod, objcclass | |
| UISearchController=ObjCClass('UISearchController') | |
| class SearchableTableView(ui.View): | |
| '''Works like a tableview, except that search bar is shown. |
This file contains hidden or 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 weakref | |
| class Self_Closing_Automatic(type): | |
| def __call__(cls, *args, **kwargs): | |
| ''' called when you call MyClass() | |
| Create the object, then add a weakref finalizer''' | |
| obj = type.__call__(cls, *args, **kwargs) | |
| ''' get list of all attribs that have `close`''' | |
| close_list = [getattr(obj,a) for a in dir(obj) if hasattr(getattr(obj,a),'close') and not isinstance(getattr(obj,a),type)] | |
| ''' This sort of depends on the close convention... maybe a |
This file contains hidden or 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
| from __future__ import absolute_import | |
| from __future__ import print_function | |
| import requests, urllib.parse | |
| import time,datetime | |
| from six.moves import range | |
| class Quote(object): | |
| DATE_FMT = '%Y-%m-%d' | |
| TIME_FMT = '%H:%M:%S' |
This file contains hidden or 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
| from ctypes import * | |
| COMPRESSION_LZMA = 0x306 | |
| c=CDLL(None) | |
| def encode(instr): | |
| outbuf = create_string_buffer(max(32767,len(instr))) | |
| inbuf = create_string_buffer(len(instr)) | |
| insz=len(instr) |
This file contains hidden or 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
| #!python2 | |
| """ | |
| A small client illustrating how to interact with the Sage Cell Server, version 2 | |
| Requires the websocket-client package: http://pypi.python.org/pypi/websocket-client | |
| """ | |
| import websocket | |
| import json |
This file contains hidden or 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
| #!python2 | |
| """ | |
| A small client illustrating how to interact with the Sage Cell Server, version 2 | |
| Requires the websocket-client package: http://pypi.python.org/pypi/websocket-client | |
| """ | |
| import websocket | |
| import json |
This file contains hidden or 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
| ''' | |
| minimal avplayer example | |
| ''' | |
| from objc_util import * | |
| AVPlayerItem=ObjCClass('AVPlayerItem') | |
| AVPlayer=ObjCClass('AVPlayer') | |
| AVPlayerLayer=ObjCClass('AVPlayerLayer') | |
| import photos | |
| def pick_asset(): | |
| assets = photos.get_assets(media_type='video') |
This file contains hidden or 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 sys,re, mmap | |
| '''static libs/syms | |
| with open(sys.executable,'rb') as f: | |
| m=mmap.mmap(f.fileno(),0, access=mmap.ACCESS_READ) | |
| symbols=re.findall(b'@_(\w*)',m) | |
| with open(sys.executable,'rb') as f: | |
| m=mmap.mmap(f.fileno(),0, access=mmap.ACCESS_READ) | |
| frameworks=re.findall(b'(/Sys[\w/\.]*\.framework)',m) |
This file contains hidden or 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
| from __future__ import absolute_import | |
| from __future__ import print_function | |
| import urllib.request, urllib.parse | |
| import time,datetime | |
| from six.moves import range | |
| class Quote(object): | |
| DATE_FMT = '%Y-%m-%d' | |
| TIME_FMT = '%H:%M:%S' |
This file contains hidden or 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
| from objc_util import * | |
| from threading import Thread, Condition, Event, current_thread,enumerate | |
| m=ObjCClass('CLLocationManager').sharedManager() | |
| class Location(): | |
| def __init__(self,cllocation): | |
| self.altitude=cllocation.altitude() | |
| self.lat=cllocation.coordinate().a | |
| self.lon=cllocation.coordinate().b |