Skip to content

Instantly share code, notes, and snippets.

@LukeChannings
LukeChannings / serve_deno_cache.ts
Last active February 19, 2021 13:00
serve_deno_cache.ts
import { serve } from "https://deno.land/std@0.83.0/http/server.ts";
import { walk } from "https://deno.land/std@0.83.0/fs/walk.ts";
const PORT = 8001;
interface DenoInfo {
denoDir: string;
modulesCache: string;
typescriptCache: string;
}
@LukeChannings
LukeChannings / scriptable-prometheus-example.js
Created November 26, 2020 14:16
scriptable-prometheus-example.js
const PROMETHEUS_ENDPOINT = 'prometheus.example.com'
const fetchMetric = async (query) => {
const url = `https://${PROMETHEUS_ENDPOINT}/api/v1/query?query=${encodeURIComponent(query)}`
const req = new Request(url)
return req.loadJSON()
}
const getPVCAvailability = (pvc) => {
return fetchMetric(`kubelet_volume_stats_available_bytes{persistentvolumeclaim="${pvc}"}`)
This file has been truncated, but you can view the full file.
[zigbee2mqtt-5555976c54-vkh8k] Using '/app/data' as data directory
[zigbee2mqtt-5555976c54-vkh8k]
[zigbee2mqtt-5555976c54-vkh8k] > zigbee2mqtt@1.13.0-dev start /app
[zigbee2mqtt-5555976c54-vkh8k] > node index.js
[zigbee2mqtt-5555976c54-vkh8k]
[zigbee2mqtt-5555976c54-vkh8k] zigbee2mqtt:info 2020-05-19 19:12:34: Logging to console and directory: '/app/data/log/2020-05-19.19-12-34' filename: log.txt
[zigbee2mqtt-5555976c54-vkh8k] zigbee2mqtt:info 2020-05-19 19:12:34: Starting zigbee2mqtt version 1.13.0-dev (commit #134f671)
[zigbee2mqtt-5555976c54-vkh8k] zigbee2mqtt:info 2020-05-19 19:12:34: Starting zigbee-herdsman...
[zigbee2mqtt-5555976c54-vkh8k] CREATED DECONZ ADAPTER
[zigbee2mqtt-5555976c54-vkh8k] zigbee2mqtt:info 2020-05-19 19:12:35: zigbee-herdsman started
---
apiVersion: v1
kind: ConfigMap
metadata:
name: sample-grafana-dashboard
labels:
grafana_dashboard: "1"
data:
unifi-poller-client-dpi-prometheus_rev3.json: |-
{
@LukeChannings
LukeChannings / README.markdown
Created May 10, 2020 14:56
dconz on kubernetes

This manifest will run dconz on a kubernetes cluster and map a CONBEE 2 stick to the container. It's useful if you need to update the ConBee firmware and don't have Docker running directly on the host.

Update the nodeSelector and dconzrc hostPath to your needs.

---
kubeEtcd:
enabled: false
kubeProxy:
enabled: false
prometheus:
prometheusSpec:
storageSpec:
volumeClaimTemplate:
spec:
import React, { memo } from "react";
import {
pie,
arc,
extent,
interpolateSinebow,
PieArcDatum
} from "d3";
import { formatCurrency } from "../lib/monzo";
import { jsonEqual } from "../util";
@LukeChannings
LukeChannings / Graphics Rules.sgr
Last active December 30, 2019 12:17
Sims 2 Intel UHD Graphics 620
#############################################################################
#
# Logging settings
#
set logGroup "ConfigurationManager"
set logLevelWarning warning
set logLevelInfo info
set logLevelDebug debug
@LukeChannings
LukeChannings / queryStringToDict.js
Created October 16, 2018 15:27
queryStringToDict.js
const queryStringToDict = qs => qs
.split('&')
.map(pair => pair.split('=').map(decodeURIComponent))
.reduce((dict, [key, value = true]) => ({ ...dict, [key]: value }), {})
@LukeChannings
LukeChannings / rsort.js
Created September 19, 2018 08:31
rsort - recursively sort a data structure
const rsort = data => {
if (Array.isArray(data)) {
if (data.every(a => /(string|number|undefined)/.test(typeof a) || a === null)) return data.sort()
return data.map(rsort).sort()
}
if (typeof data === 'object' && data !== null) {
return Object.entries(data)
.sort(([k], [_k]) => k > _k)
.reduce((o, [k, v]) => ({ ...o, [k]: rsort(v) }), {})