Skip to content

Instantly share code, notes, and snippets.

View nrbrook's full-sized avatar

Nick Brook nrbrook

View GitHub Profile
@nrbrook
nrbrook / addKey
Created September 10, 2016 13:02
# in ~/Library/LaunchAgents/com.user.addkeyonlogin.plist (replace <path to home>)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.addkeyonlogin</string>
<key>Program</key>
<string><path to home>/.ssh/addkeyonlogin</string>
@nrbrook
nrbrook / create_native_gecko.py
Last active April 10, 2018 11:21
A python script to extract the events from SI Labs native_gecko.h into an event loop handler that calls weak functions, allowing you to define event handler functions with parameters instead of a big switch statement with an event data struct.
#!/usr/bin/env python
import re
native_gecko_file = open("/Applications/Simplicity Studio.app/Contents/Eclipse/developer/sdks/gecko_sdk_suite/v2.2/protocol/bluetooth/ble_stack/inc/soc/native_gecko.h", "r")
contents = native_gecko_file.read()
native_gecko_file.close()
pattern = re.compile(r'gecko_evt_(.*?)_id\s')