Skip to content

Instantly share code, notes, and snippets.


Sam Thorogood samthor

View GitHub Profile
samthor /
Last active May 22, 2021
Read/write Clipsal smart switches

This is notes for anyone who is interacting with (in Australia at least) Clipsal-branded smart switches that operate over BLE. (They also come with a ZigBee certification document, but it seems like it was never enabled.)

They have a couple of interesting UUIDs (these are here for y'all searching for them):

  • Control service, 720a9080-9c7d-11e5-a7e3-0002a5d5c51b

    • State characteristic (i.e., switch on/off), 720a9081-9c7d-11e5-a7e3-0002a5d5c51b
    • Level characteristic (i.e., brightness), 720a9082-9c7d-11e5-a7e3-0002a5d5c51b
  • Command service, 720a7080-9c7d-11e5-a7e3-0002a5d5c51b

    • Request characteristic, 720a7081-9c7d-11e5-a7e3-0002a5d5c51b
samthor / daikin-update-wifi.js
Last active Apr 7, 2021
Update WiFi on Daikin BRP069A42
View daikin-update-wifi.js
// If the device is already on a network and you need to change it, you can load:
// http://<device_ip>/common/get_wifi_setting
// It'll give you a result like... ret=OK,ssid=OldSSIDHere,security=mixed,key=%6e%65%76%65%72%67%6f%6e%6e%61%67%69%76%65%79%6f%75%75%70
// To update the same data, open that page and in the console, run this (modify as needed):
const ssid = 'NewSSIDHere';
const key = 'nevergonnagiveyouup';
const encoded = Array.from(key).map((c) => '%' + c.charCodeAt(0).toString(16).padStart(2, '0')).join('');
View viz-observer.js
// This is now a library:
// ... source on GitHub:
// ... package on npm:
samthor /
Created Oct 27, 2020
Major changes in Node

Major Node Changes

This document is a short list of changes in Node.js' major releases. It does not cover point releases, just e.g., v13, v14 and so on.


  • NPM 7 #35631
  • Throw On Unhandled Rejections #33021
    • If you create a Promise without a catch handler, or use a top-level await, a failure will cause your program to crash by default
View active-element.js
* @param {!Element=}
* @return {!Array<!Element>} containing focused element, deepest first
function getActive(t = document.activeElement || document.body) {
if (t.activeElement) {
t = t.activeElement;
if (t.shadowRoot) {
return [...getActive(t.shadowRoot), t];
View notes.html
Copyright 2020 Google LLC.
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
Unless required by applicable law or agreed to in writing, software
View wrap.go
package loggerwrap
import (
View post-eleventy-build.js
let configured = false;
let finished = false;
const methodsToCall = [];
function setup() {
const Eleventy = require("@11ty/eleventy");
const originalWrite = Eleventy.prototype.write;
Eleventy.prototype.write = async function(...args) {
const out = await originalWrite.apply(this, args);
samthor / logcat
Last active Jan 29, 2020
Better logcat
View logcat
#!/usr/bin/env python
import logging
import subprocess
import re
import sys
import datetime
RE_SPACES = re.compile('\s+')
samthor / css-modules-plugin.mjs
Last active Apr 26, 2020
CSS Modules plugin for Rollup
View css-modules-plugin.mjs
import fs from 'fs';
// as per
export default function cssModules() {
return {
name: 'css-modules',
async load(id) {
if (!id.endsWith('.css')) {