Parts:
- SparkFun Humidity Sensor Breakout - SHTC3 (Qwiic)
- SparkFun Qwiic pHAT v2.0 for Raspberry Pi
- Raspberry Pi 3 B+
Reference Material:
- SHTC3_Datasheet
- smbus2 Python library
| export default (e,a,...z)=> | |
| z.reduce((e,c)=>(e.append(c),e) | |
| ,Object.assign(e.nodeType ? e : document.createElement(e), a)) |
| // See https://web.dev/text-fragments/ | |
| // location.hash = searchFragment('text to find in page') | |
| export const searchFragment = txt => `#:~:text=${encodeURI(txt)}` |
| /* from Kevin Powell's [3 useful CSS tricks](https://www.youtube.com/watch?v=HOM47v73yG8) | |
| * for <div class=box></div> | |
| * useful for iframes, videos, pictures, etc. | |
| */ | |
| .box { | |
| width: 25rem; | |
| aspect-ratio: 1 / 1; | |
| position: fixed; | |
| inset: 0rem; /* sets top/bottom/left/right to same value */ |
| import {networkInterfaces} from 'os' | |
| import {isIP, BlockList} from 'net' | |
| export function * iter_subnet_matches(ip_query) { | |
| let family = isIP(ip_query) | |
| let ipv = 'ipv'+family | |
| for (let [if_name, if_addrs] of Object.entries(networkInterfaces())) { | |
| for (let each of if_addrs) { | |
| if (family != each.family) |
| async function blobAsDataURL(blob) { | |
| let rdr = new FileReader() | |
| await new Promise((onload, onerror) => { | |
| rdr.onload = onload | |
| rdr.onerror = onerror | |
| rdr.readAsDataURL(blob) }) | |
| return rdr.result | |
| } |
| export function parse_html(raw_html_string) { | |
| return new DOMParser() | |
| .parseFromString(raw_html_string, 'text/html') } | |
| export function dom_to_html_blob(dom) { | |
| let html_doc = new XMLSerializer() | |
| .serializeToString(dom) | |
| return new Blob([html_doc], {type: 'text/html'}) } | |
| export function dom_to_html_blob_url(dom) { |
| class CBORDecoderBase { | |
| // Possible monkeypatch apis responsibilities: | |
| // decode() :: | |
| // *iter_decode() :: | |
| // async decode_stream() :: | |
| // async * aiter_decode_stream() :: | |
| static options(options) { | |
| return (class extends this {}) | |
| .compile(options)} |
Parts:
Reference Material:
| class Awesome { | |
| fn = ns => (console.log('instance function', this), this) | |
| static s_fn = ns => (console.log('static function', this), this) | |
| val = (ns => (console.log('instance iife', this), this))() | |
| static s_val = (ns => (console.log('static iife', this), this))() | |
| } | |
| console.log('Awesome.s_val', Awesome.s_val === Awesome, Awesome.s_val) | |
| // true |
| const worker_src = ` | |
| console.log("Worker from a Blob URL:", typeof self) | |
| ` | |
| const blob_worker = new Blob([worker_src], {type: 'application/javascript'}) | |
| const bloburl_worker = URL.createObjectURL(blob_worker) | |
| console.log({bloburl_worker}) | |
| const wkr = new Worker(bloburl_worker, {type: 'module'}) |