Skip to content

Instantly share code, notes, and snippets.

View jacobrosenthal's full-sized avatar

Jacob Rosenthal jacobrosenthal

View GitHub Profile
var fs = require('fs');
var moment = require('moment-timezone');
moment().tz("America/Phoenix").format();
fs.readdir( process.argv[2], function (err, files) {
if (err){
console.log("error", err);
return;
}
peripheralUuidString is a lower case string no dashes
serviceUuidString is a lower case string no dashes
characteristicUuidString is a lower case string no dashes
serviceUuidString is a lower case string no dashes
serviceUuidsArray, array of serviceUuidString
descriptorHandle TODO
propertyString one of ['broadcast', 'read', 'writeWithoutResponse', 'write', 'notify', 'indicate', 'authenticatedSignedWrites', 'extendedProperties']
propertiesArray containing one or more of propertyString
descriptorObject = {
corebluetooth
Jacobs-MacBook-Air:noble jacobrosenthal$ node examples/advertisement-discovery.js
peripheral discovered (5de0dfa124b242ba8fdfa8eb6d9e3542 with address <00:22:d0:2a:e4:a3, unknown>, connectable true, RSSI -40:
hello my local name is:
undefined
can I interest you in any of the following advertised services:
["180d"]
here is my manufacturer data:
"6b00010000"
my TX power level is:
@jacobrosenthal
jacobrosenthal / corebluetooth bindings
Last active July 16, 2016 22:39
bindings timing test
Jacobs-MacBook-Air:noble jacobrosenthal$ node examples/timetest.js
corebluetooth bindings
startScanning: 4.501ms
stopScanning: 0.555ms
^C
Jacobs-MacBook-Air:noble jacobrosenthal$ node examples/timetest.js
corebluetooth bindings
startScanning: 8.440ms
stopScanning: 0.465ms
^C
@jacobrosenthal
jacobrosenthal / app.js
Last active July 15, 2016 04:48
Ring Zero Webbluetooth
var canvas = document.querySelector('canvas');
var statusText = document.querySelector('#scanBtn');
statusText.addEventListener('click', function() {
statusText.textContent = 'scanning...';
ring.connect()
.then(() => ring.startNotificationsEvents().then(handleEvent))
.then(() => {
statusText.textContent = 'got one...';
#!/usr/bin/env python
#https://xlsxwriter.readthedocs.org/example_unicode_polish_utf8.html
##############################################################################
#
# A simple example of converting some Unicode text to an Excel file using
# the XlsxWriter Python module.
#
# This example generates a spreadsheet with some Polish text from a file
openocd -f interface/jlink.cfg -c "adapter_khz 2000; transport select swd;set WORKAREASIZE 0;" -f target/nrf51.cfg -c "init; reset init; halt; nrf51 mass_erase; program blah.hex 0x0 verify; exit;"
@jacobrosenthal
jacobrosenthal / gist:4bcda26e012d46149c2c
Created January 20, 2016 04:36
shitty example for the mbed mpu6050 library
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
// set the data rate for the SoftwareSerial port
mySerial.begin(115200);
}
@jacobrosenthal
jacobrosenthal / gist:868186848962af0ee7ae
Created October 22, 2015 06:20
Node serialport error log when using old version of Visual Studio
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
serialport.cpp
c:\users\jacobrosenthal\.node-gyp\4.2.1\include\node\v8.h(336): error C2988: unrecognizable template declaration/definition [c:\Users\jacobrosenthal\node-serialport\build\serialport.vcxproj]
c:\users\jacobrosenthal\.node-gyp\4.2.1\include\node\v8.h(336): error C2059: syntax error : 'using' [c:\Users\jacobrosenthal\node-serialport\build\serialport.vcxproj]
c:\users\jacobrosenthal\.node-gyp\4.2.1\include\node\v8.h(469): error C2988: unrecognizable template declaration/definition [c:\Users\jacobrosenthal\node-serialport\build\serialport.vcxproj]
c:\users\jacobrosenthal\.node-gyp\4.2.1\include\node\v8.h(469): error C2059: syntax error : 'using' [c:\Users\jacobrosenthal\node-serialport\build\serialport.vcxproj]
c:\users\jacobrosenthal\.node-gyp\4.2.1\include\node\v8.h(472): error C2332: 'enum' : missing tag name [c:\Users\jacobrosenthal\node-serialport\build\serialport.vcxproj]
c:\users\jaco