Skip to content

Instantly share code, notes, and snippets.

@planecore
planecore / Coronavirus.js
Last active November 11, 2022 16:27
Coronavirus Scriptable Widget
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: user-md;
// change "country" to a value from https://coronavirus-19-api.herokuapp.com/countries/
const country = "Israel"
const url = `https://coronavirus-19-api.herokuapp.com/countries/${country}`
const req = new Request(url)
const res = await req.loadJSON()
if (config.runsInWidget) {
List with Compatible devices:
Look under About on the watch for the device Id.
looks something like this:
MOY-TEH5-1.7.7
the middle section is the interesting part, if that is in this list here
it has the compatible bootloader and the same pinout as pinetime for Display and External Flash
@atc1441
atc1441 / UpdateProtocolDafit.txt
Last active September 10, 2023 21:32
DaFit App Update Protocol manual
Basic Manual for DaFit Fitness Tracker firmware update protocol, works for nearly any nRF52832 tracker from Company DaFit
The minimum size of update file is 0x10000(can be filled with garbage to get to size) and the maximum size is 0x2F000
the update will first get stored onto the external flash at position 0x3D1000 by the stock firmware(not by the bootloader)
the size of the update will get stored at 0x3D0000 on external flash with 4 bytes uint32_t
when bootloader gets activated it will copy the update from external flash to 0x23000 of the nRF52 internal flash.
Connect to device,
301 Response:{"code":1,"data":{"id":"e2519892387b49c89df17e68fc6bb8ae","url":"http://veryfitpro-test.oss-cn-shenzhen.aliyuncs.com/firmwares/71b1386bf03a47f0b116fe326198b028.zip","forceUpdate":false,"descriptionChinese":"<p>test</p>","descriptionEnglish":"<p><br></p>","version":5,"specialUpgrade":false},"message":"µƒÑÞ»óµêÉÕèƒ"}
303 Response:{"code":1,"data":{"id":"1226dea3a8a8453bba6df8babd0536d4","url":"http://veryfitpro-test.oss-cn-shenzhen.aliyuncs.com/firmwares/018e34e29a66415ab515e83a551edcf0.zip","forceUpdate":false,"descriptionChinese":"<p>Test</p>","descriptionEnglish":"<p><br></p>","version":13,"specialUpgrade":false},"message":"µƒÑÞ»óµêÉÕèƒ"}
554 Response:{"code":1,"data":{"id":"0832ebe3d3414343b60fd7a449845eb3","url":"http://veryfitpro-test.oss-cn-shenzhen.aliyuncs.com/firmwares/3d507e57ae074c20b273fee6ce56ecc9.zip","forceUpdate":false,"descriptionChinese":"<p><br></p>","descriptionEnglish":"<p>test1</p>","version":51,"specialUpgrade":false},"message":"µƒÑÞ»óµêÉÕèƒ"}
572 Response:{"code":1,"data":{
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 6 columns, instead of 3. in line 8.
Domain,Cname,Provider,IsVulnerable,IsTakenOver,Response
abroad.api.comm.intl.miui.com,abroad-api-comm-intl-303810307.ap-south-1.elb.amazonaws.com.,amazonaws,false,false,NoSuchBucket
abroad.api.comm.intl.miui.com,abroad-api-comm-intl-303810307.ap-south-1.elb.amazonaws.com.,amazonaws,false,false,The specified bucket does not exist
admin.en.miui.com,admin.en.miui.com.n.mi-dun.srv.,,true,false,Dead DNS record
api.calendar.intl.miui.com,api-calendar-intl-531084470.ap-south-1.elb.amazonaws.com.,amazonaws,false,false,NoSuchBucket
api.calendar.intl.miui.com,api-calendar-intl-531084470.ap-south-1.elb.amazonaws.com.,amazonaws,false,false,The specified bucket does not exist
api.gallery.intl.miui.com,api-gallery-intl-1897308404.ap-south-1.elb.amazonaws.com.,amazonaws,false,false,NoSuchBucket
api.gallery.intl.miui.com,api-gallery-intl-1897308404.ap-south-1.elb.amazonaws.com.,amazonaws,false,false,The specified bucket does not exist
api.content.intl.miui.com,api-content-intl-1793341579.ap-south-1.elb.amazonaws.com.,amazona
@stonehippo
stonehippo / Adafruit_nrf52_example.ino
Last active June 25, 2021 21:39
Some example Arduino IDE code showing how to do various things with Adafruit nrF52 Feather BLE
/*
* Adafruit nRF52 Feather Example
* Copyright (c) 2018-2019 George White <stonehippo@gmail.com>
*
* MIT LICENSE, see LICENSE.txt at https://gist.github.com/stonehippo/ffbed2f32e1813f4019ecedd22062636
*
* I made this example file for a coworker. It illustrates a few things:
*
* - Setting up a custom service
* - Setting up custom characteristics on that service
import UIKit
class ViewController: UIViewController {
var btHelper: BTHelper = BTHelper()
var timer: Timer? = nil
var bgTask = BackgroundTask()
@objc func stop() { btHelper.shutOff() }
@objc func action() { btHelper.startUp() }
@bgloh
bgloh / MibandService.java
Created July 7, 2017 03:14
Mi band Service UUID
package me.flyingrub.mibandnotify.miband;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class MiBandService {
public static final String MAC_ADDRESS_FILTER = "88:0F:10";

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
import Cocoa
import CoreBluetooth
import PlaygroundSupport
public class BTHelper: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate {
// BLE Access
var centralManager: CBCentralManager
override init() {
self.centralManager = CBCentralManager(delegate: nil, queue: nil)