Skip to content

Instantly share code, notes, and snippets.

Avatar

Tabish Chasmawala tabchas

View GitHub Profile
@pudquick
pudquick / remove_bt.py
Created Oct 7, 2016
Remove all Bluetooth devices from OS X / macOS in the style of the Bluetooth debug menu "Remove all devices" with python and pyobjc
View remove_bt.py
#!/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 Apr 25, 2014
Bluetooth LE on OS X via Python
View gist:11284662
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 Feb 5, 2014
Bluetooth Low Energy explorer, working on MacOSX 10.9 using latest Pyobjus.
View ble.py
from pyobjus import autoclass, protocol
from pyobjus.dylib_manager import load_framework, INCLUDE
(CBCentralManagerStateUnknown,
CBCentralManagerStateResetting,
CBCentralManagerStateUnsupported,
CBCentralManagerStateUnauthorized,
CBCentralManagerStatePoweredOff,
CBCentralManagerStatePoweredOn) = range(6)