Skip to content

Instantly share code, notes, and snippets.

View bendtherules's full-sized avatar
💭
Loving Typescript ...

Abhas Bhattacharya bendtherules

💭
Loving Typescript ...
View GitHub Profile
@bendtherules
bendtherules / Lenovo-HS11-Smart-Scale-BLE-protocol.md
Last active July 31, 2023 15:16
Lenovo HS11 Smart Scale BLE protocol (Chipsea CST34M97 chip)

Lenovo HS11 Scale picture

This is bluetooth (BLE) Gatt protocol for Lenovo HS11 Smart weight scale. It uses Chipsea CST34M97 chip, similar to some Huawei scales.

Main service = 0000fff0-0000-1000-8000-00805f9b34fb
Send command Characteristic = 0000fff1-0000-1000-8000-00805f9b34fb
Receive data Characteristic = 0000fff4-0000-1000-8000-00805f9b34fb

To read last N weight measurements

@bendtherules
bendtherules / GFit-treadmill-BLE-Protocol.md
Last active July 23, 2023 06:00
Control GFit Treadmills with BLE protocol - read and write

Gfit treadmill BLE protocol

What is this?

GFit by FutureGo is an android/ios app to read and control supported BLE treadmills - usually made in China but white-labelled and sold under different names. This is an effort to document the Bluetooth protocol for it, only for personal use.

Sold under brands - Fitkit, Cultsport, Voit.

Not in scope - Elliptical treadmill, Rowers (also supported by Gfit app, but not documented here)

@bendtherules
bendtherules / parseBluetoothDMM.js
Created July 13, 2023 09:54
Parse Bluetooth DMM Multimeter string (Baba AD-900)
// Reference - https://github.com/ludwich66/Bluetooth-DMM/wiki/Protocol-all-Variants
// From my multimeter - Baba AD-900 (Generic name - ZOYI ZT-300AB)
// rawString = '1B-84-70-A1-49-DA-B8-7B-66-DA-3A' // few mv //mv enabled both mV and V flag
rawString = '1B-84-70-D1-3D-2B-75-7F-66-FA-3A'; // 3.764 V // enabled V flag
function zeroPad(num, places) {
return String(num).padStart(places, '0');
}
@bendtherules
bendtherules / example.js
Created November 14, 2020 07:26
property-reference-readspecwithus- example
obj = {
a: 123,
get ab() {return 456},
get abc() {return this.a},
}
obj.a
obj["a"+"b"]
@bendtherules
bendtherules / spec-not-found-sections.json
Last active June 30, 2020 14:13
Section ids used in engine262 which are now invalid
[
"sec-numeric-types-bigint-unsighedRightShift",
"sec-allocatedtypedarray",
"sec-typedarray-species-create",
"sec-running-execution-context",
"sec-evaluate-expression-key-property-access",
"sec-evaluate-identifier-key-property-access"
]
@bendtherules
bendtherules / IsPropertyReference.js
Last active March 19, 2020 14:14
IsPropertyReference? - Example for foo.bar() article
// IsPropertyReference?
// 1. Different notations for accessing a property name
foo.bar() // ✅
foo["any string here"]() // ✅
// 2 Property name can also be a symbol - inbuilt or custom
someArray[Symbol.iterator].toString() // ✅
@bendtherules
bendtherules / try.graphql
Last active May 23, 2019 05:28
github_graphql
{
repositoryOwner(login: "bendtherules") {
repositories(first: 100, isFork: true) {
nodes {
id
nameWithOwner
refs(refPrefix: "refs/heads/", last: 100) {
edges {
node {
branchName: name
*{background:#5d3a3a;margin:0;}p{width:200px;height:200px;background:#b5e0ba;}
@bendtherules
bendtherules / ruleSlow.js
Last active March 19, 2019 10:58
Slow down getStatus request
// change to slow down get order status
module.exports = {
summary: 'slow down placing order (https)',
*beforeDealHttpsRequest(requestDetail) {
return true;
},
*beforeSendRequest(requestDetail) {
const newRequestOptions = requestDetail.requestOptions;
// set rejectUnauthorized as false
newRequestOptions.rejectUnauthorized = false;
@bendtherules
bendtherules / hooks-demo.jsx
Created January 20, 2019 14:39
Demo code with react hooks
import { useState } from 'react';
function Example() {
// Declare a new state variable, which we'll call "count"
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>