Skip to content

Instantly share code, notes, and snippets.

@mddub
mddub / commands.sh
Created Jun 24, 2015
Make an inbox burndown timelapse
View commands.sh
#####################################
# Capture webcam images and log inbox
#####################################
# Install imagesnap: http://iharder.sourceforge.net/current/macosx/imagesnap/
# Install gmail-logger: https://github.com/mddub/gmail-logger
# Make a directory to store the screenshots and webcam images
mkdir images
View bg_in_menubar.py
import os
from ConfigParser import ConfigParser
from datetime import datetime
from dateutil.parser import parser
from dateutil.tz import tzlocal
import requests
import rumps
date_parser = parser()
View medtronic-nightscout-uploading-options.md

Options to upload data from a Medtronic pump to Nightscout

First pass; others, please correct or fill in gaps.

  • MiniMed Connect
    • Default behavior (using the Medtronic iOS app paired with a Connect)
      • Real-time: we can scrape the data the Connect sends to Medtronic's servers using [minimed-connect-to-nightscout]. It's not much -- just BG data, active insulin, reservoir, etc. [See this sample]
      • Historical: once a day, the Medtronic app asks the Connect to poll the pump for history, then uploads that into CareLink. SPECULATIVE: you could run [mmcsv] regularly to translate and upload that data to Nightscout. You'd have pump data alongside CGM data delayed by ~24 hours.
    • Custom behavior (using an open source iOS app paired with a Connect)
      • Real-time: SPECULATIVE: @bewest has captured a conversation between a Connect and a pump, suggesting it makes the same history requests as a CareLink stick. We could develop an app to impersonate the Medtronic iOS app and request that dat
View report.js.diff
diff --git a/static/report/js/report.js b/static/report/js/report.js
index 924bbcb..8b61b8c 100644
--- a/static/report/js/report.js
+++ b/static/report/js/report.js
@@ -44,6 +44,14 @@
};
var ONE_MIN_IN_MS = 60000;
+
+ function startOfDayForQuery(day) {
View basal-set-temp.js.diff
diff --git a/lib/basal-set-temp.js b/lib/basal-set-temp.js
index ea0a80e..cf52021 100644
--- a/lib/basal-set-temp.js
+++ b/lib/basal-set-temp.js
@@ -13,22 +13,9 @@ var setTempBasal = function (rate, duration, profile, rT, currenttemp) {
return rT;
}
- var suggestedRate = Math.round((Math.round(rate / 0.05) * 0.05)*100)/100;
- if (suggestedRate === profile.current_basal) {
View basal-set-temp.js.diff
diff --git a/lib/basal-set-temp.js b/lib/basal-set-temp.js
index cf52021..ea0a80e 100644
--- a/lib/basal-set-temp.js
+++ b/lib/basal-set-temp.js
@@ -13,9 +13,22 @@ var setTempBasal = function (rate, duration, profile, rT, currenttemp) {
return rT;
}
- rT.duration = duration;
- rT.rate = Math.round((Math.round(rate / 0.05) * 0.05)*100)/100;
View mock-dexcom.py
import json
import random
from flask import Flask, request
app = Flask(__name__)
x = 0
@app.route('/ShareWebServices/Services/General/LoginPublisherAccountByName', methods=['post'])
View battery_component.c.diff
$ git diff src/battery_component.c
diff --git a/src/battery_component.c b/src/battery_component.c
index 9faf595..1d563b7 100644
--- a/src/battery_component.c
+++ b/src/battery_component.c
@@ -31,6 +31,29 @@ static int battery_icon_id(BatteryChargeState charge_state) {
}
}
+#ifdef PBL_COLOR
@mddub
mddub / main.c
Created Aug 16, 2016
no-appmessage-timeout: Pebble app
View main.c
#include <pebble.h>
static Window *s_window;
static TextLayer *s_text_layer;
static char s_status[256];
static void clear_status() {
static char buf[16];
time_t now = time(NULL);
strftime(buf, sizeof(buf), "%H:%M:%S", localtime(&now));
@mddub
mddub / listen-app-message.py
Created Aug 16, 2016
no-appmessage-timeout: libpebble2 code
View listen-app-message.py
from threading import Event
from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.serial import SerialTransport
from libpebble2.protocol.appmessage import AppMessage
from libpebble2.protocol.appmessage import AppMessageACK
from libpebble2.protocol.appmessage import AppMessagePush
pebble = PebbleConnection(SerialTransport("/dev/rfcomm0"))
pebble.connect()