Skip to content

Instantly share code, notes, and snippets.

View SoulAuctioneer's full-sized avatar

Ash Eldritch SoulAuctioneer

View GitHub Profile
@SoulAuctioneer
SoulAuctioneer / Bluetooth.java
Created May 1, 2015 16:55
Bluetooth Low Energy (BLE) helper class for Android, including a queue for characteristic writes. See http://stackoverflow.com/questions/18011816/has-native-android-ble-gatt-implementation-synchronous-nature
package com.nojack;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
@SoulAuctioneer
SoulAuctioneer / gist:29bc2bcec3d9fb046f90
Created October 4, 2014 06:00
Android class to reliably detect that a Bluetooth Low Energy device has been moving further away and crossed a specific threshold, by testing for a consistently declining moving average of RSSI. Needed because Bluetooth sequential RSSI readings can be highly variable. No actual Bluetooth code here so can easily be repurposed.
package com.android;
/**
* Created by Ash Eldritch.
*
* Bluetooth RSSI is very volatile, and so in its raw form not a reliable method to detect change in proximity.
* Here, I use a moving average over a number of RSSI samples, plus a test for consistently declining RSSI over
* those samples. This much more accurately determines that the Bluetooth device is moving away.
*
* To use:
@SoulAuctioneer
SoulAuctioneer / extract_ppt_notes.py
Last active December 16, 2015 04:29
Extract slide notes from PowerPoint
import zipfile
import cStringIO
from xml.dom import minidom
class ExtractPptNotes(object):
_chunks = None
def __init__(self, file_data):