Skip to content

Instantly share code, notes, and snippets.

@ps2
ps2 / gist:b714b7ae08642ffdae93ca22731f06b5
Last active October 22, 2016 21:16
sensor data at 3:38
# Initial read
2016-10-22 15:38:54.653694 RileyLink[22328:9159570] GlucosePage 00 - (bytes 000-255): 0541400008052143000c050143000c050143000b0541400008050157020a0541400008052157020c054140000c0541400008052140000c10174a820c10174a820b000001101857811000000110185c811000000110185e811000000110186e8e1010386f8e0b10186f8e0b00000110186d9410000001101849951000000110184396100000011018479710000001101e728d100000011007b38c100000011007b48c100000011007b59410000001100782951000000110078f961000000110088a97100000011009b992100000011014b5941000000110148e95100000011015948c100000011015848f101035b1900b1036938d0d0004020402040204020402
2016-10-22 15:38:54.665307 RileyLink[22328:9159570] GlucosePage 00 - (bytes 256-511): 04030304030303020402040204020402040204020402040204020402040204020402040204000300036610169a8f0e01036610169f8f0e010301000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2016-10-22 16:15:37.977536 RileyLink[22343:9172021] GlucosePage 00 - (bytes 000-255): 0541400008052143000c050143000c050143000b0541400008050157020a0541400008052157020c054140000c0541400008052140000c10174a820c10174a820b000001101857811000000110185c811000000110185e811000000110186e8e1010386f8e0b10186f8e0b00000110186d9410000001101849951000000110184396100000011018479710000001101e728d100000011007b38c100000011007b48c100000011007b59410000001100782951000000110078f961000000110088a97100000011009b992100000011014b5941000000110148e95100000011015948c100000011015848f101035b1900b1036938d0d0004020402040204020402
2016-10-22 16:15:37.988285 RileyLink[22343:9172021] GlucosePage 00 - (bytes 256-511): 04030304030303020402040204020402040204020402040204020402040204020402040204000300036610169a8f0e01036610169f8f0e0103010333de141016ac8f0f32323130132f2e01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Page data:
2016-10-22 19:18:06.038064 RileyLink[22532:9245270] GlucosePage 00 - (bytes 000-255): 0541400008052143000c050143000c050143000b0541400008050157020a0541400008052157020c054140000c0541400008052140000c10174a820c10174a820b000001101857811000000110185c811000000110185e811000000110186e8e1010386f8e0b10186f8e0b00000110186d9410000001101849951000000110184396100000011018479710000001101e728d100000011007b38c100000011007b48c100000011007b59410000001100782951000000110078f961000000110088a97100000011009b992100000011014b5941000000110148e95100000011015948c100000011015848f101035b1900b1036938d0d0004020402040204020402
2016-10-22 19:18:06.050216 RileyLink[22532:9245270] GlucosePage 00 - (bytes 256-511): 04030304030303020402040204020402040204020402040204020402040204020402040204000300036610169a8f0e01036610169f8f0e0103010333de141016ac8f0f32323130132f2e2e2d2d132d132c132c132d132c132c1056ba9008132b132b2b2b2c2c2d2e2f1332373c3f40424313454747461345454546464748010000000000000000000000000000000000000000000000000000000000000000000000000
crc_table16
calcCRC16(buf, len)
sub_C8069E54 - message dispatch towards end of func?
sub_C8069D60
called with len 0, 1, 2, 4
sub_C80697CC (sets byte_CC066B3C[0] = 26 = 0x1a)
sub_C806A2C8
uses CRC to validate something
sub_C80A2070
some 9 byte message with 0xCC and a lot of zeros in it
from datetime import datetime
import os
class TimestampedDiskQueue(object):
def __init__(self, path, filename_prefix, filename_extension='json', date_format="%Y-%m-%d-%H-%M-%S"):
self.path = path
self.filename_prefix = filename_prefix
self.filename_extension = filename_extension
self.date_format = "%Y-%m-%d-%H-%M-%S"
(venv) pete@sandbox-gpu1:~/smclocalize$ python3 bin/smclocalize_worker -c 1289 -n 100000
Width from firebase = (width:7.5, length:14.5)
room_size = [14.5 7.5]
room_corners = [[ 0. 0. ]
[14.5 7.5]]
child_entity_ids = [28348, 28349, 28350, 28352, 28354, 30007, 36212, 37757, 37758, 37760, 38394, 55514, 57651]
material_entity_ids = [29, 30, 31, 32, 33, 34, 688554, 688561, 688570]
teacher_entity_ids = [11028, 11029]
area_entity_ids = [29, 31, 36, 49, 50, 51, 52, 53, 54]
fixed_sensor_positions = [[ 7.25 3.75]
@ps2
ps2 / s3_rename.py
Created May 22, 2018 15:56
Utility script to move a bunch of files in s3
#!/usr/bin/env python3
import boto3
from argparse import ArgumentParser
import os
import re
import time
import pytz
from datetime import datetime
================================================================================
Processing frame 2018-05-15 18:14:00
moving_sensor_drift_tensor: [1]
room_min_scaled: [[-1.88458574 -2.72207022 -19.0838356 -0.227064267 -10.2248421 -2.13058543 -15.9964218 -3.06949019 -17.2701111 -0.873877585]...]
room_max_scaled: [[18.8154144 0.857929707 1.61616516 3.35293555 10.4751587 1.44941449 4.70357895 0.510509729 3.42988968 2.7061224]...]
x_continuous_previous_tensor: [[1.88458574 2.72207022 19.0838356 0.227064267 10.2248421 2.13058543 15.9964218 3.06949019 17.2701111 0.873877585]...]
2018-06-30 15:03:12.167767-0500 Loop[24609:13622484] [RileyLinkDevice] ======================== Save Basal Profile ===========================
2018-06-30 15:03:12.168652-0500 Loop[24609:13622484] [PumpMessageSender] getResponse(PumpMessage(carelink, setBasalProfileStandard, 3 bytes, 1 bytes), 0, 0.180000, 3)
2018-06-30 15:03:12.169518-0500 Loop[24609:13622484] [PeripheralManager+RileyLink] RL Send: 19050000000000000000b4030000a9659a6b19b199c555b2c000
2018-06-30 15:03:12.463546-0500 Loop[24609:13622486] [PeripheralManager+RileyLink] RL Recv(single): bb
2018-06-30 15:03:12.463954-0500 Loop[24609:13622486] [PeripheralManager+RileyLink] RileyLink response: PacketResponse(code: RileyLinkBLEKit.ResponseCode.commandInterrupted, packet: nil)
2018-06-30 15:03:12.554051-0500 Loop[24609:13622486] [PeripheralManager+RileyLink] RL Recv(single): dd0dbca9659a6b19b156655534d500
2018-06-30 15:03:12.555175-0500 Loop[24609:13622484] [PumpMessageSender] getResponse(PumpMessage(carelink, setBasalProfileStandard, 3 bytes, 65 bytes
@ps2
ps2 / pdm.msg
Created July 3, 2018 18:40
PDM 24 hour basal entry
1a 40 02ac49b2 00 1365 1e 36f8 006b
0005 0064 000a 0073 0014 007d 001e 0087 0028 0091
0032 009b 003c 00a5 0046 00af 0050 00b9 005a 00c3
0064 000a f06e 506e 000c 280b
139840163c0f001794de00320225510003e8001b774000640112a880047e0017e22100c80089544004e20015f900012c005b8d8005460014585501900044aa2005aa0012f12301f40036ee80060e0011b84a0258002dc6c006720010a55d02bc00273ca406d6000fb1db032000225510073a000ed8ac0384001e8480079e000e15c403e8001b77400069010594495e880018f80b01cc00eed54d0199
SetInsulinScheduleCommand(
blockType: OmniKit.MessageBlockType.setInsulinSchedule,
nonce: 44845490,