Skip to content

Instantly share code, notes, and snippets.

View tabchas's full-sized avatar

Tabish Chasmawala tabchas

View GitHub Profile
@pudquick
pudquick / remove_bt.py
Created October 7, 2016 19:53
Remove all Bluetooth devices from OS X / macOS in the style of the Bluetooth debug menu "Remove all devices" with python and pyobjc
#!/usr/bin/python
from Foundation import NSBundle
IOBluetooth = NSBundle.bundleWithIdentifier_('com.apple.Bluetooth')
IOBluetoothDevice = IOBluetooth.classNamed_('IOBluetoothDevice')
# remove configured devices
try:
devices = list(IOBluetoothDevice.configuredDevices())
except:
@jeamland
jeamland / gist:11284662
Created April 25, 2014 10:20
Bluetooth LE on OS X via Python
import select
import socket
import sys
import objc
from PyObjCTools import AppHelper
objc.loadBundle("CoreBluetooth", globals(),
bundle_path=objc.pathForFramework(u'/System/Library/Frameworks/IOBluetooth.framework/Versions/A/Frameworks/CoreBluetooth.framework'))
@tito
tito / ble.py
Created February 5, 2014 19:39
Bluetooth Low Energy explorer, working on MacOSX 10.9 using latest Pyobjus.
from pyobjus import autoclass, protocol
from pyobjus.dylib_manager import load_framework, INCLUDE
(CBCentralManagerStateUnknown,
CBCentralManagerStateResetting,
CBCentralManagerStateUnsupported,
CBCentralManagerStateUnauthorized,
CBCentralManagerStatePoweredOff,
CBCentralManagerStatePoweredOn) = range(6)