Skip to content

Instantly share code, notes, and snippets.

@shermozle
shermozle / Google Analytics date parsing in PowerBI
Created August 30, 2022 04:57
Google Analytics outputs YYYYMMDD dates in its custom reports which Excel and PowerBI can't deal with easily. This handles it.
Parsed_Date = DATE(LEFT('GA pageviews'[Date], 4), MID('GA pageviews'[Date], 5, 2), RIGHT('GA pageviews'[Date], 2))
blueprint:
name: Solar Light
description: Change the colour of a lamp based on the amount of power being imported or exported from the
domain: automation
input:
net_current_consumption:
name: Net current consumption sensor
description: Negative for exporting, positive for importing
selector:
entity:
@shermozle
shermozle / manly-hhl-home-assistant.md
Last active October 13, 2020 06:29
Get Sydney ocean conditions into Home Assistant

Show Manly Hydraulics Laboratory numbers in Home Assistant

Manly Hydraulics Laboratory have a buoy off the coast of Manly that records waves and sea temperature. Now that we're heading into the warm times I want to be able to know when it's worth going to the beach (and if I need a wetsuit).

I'm using the API key used on the website so this could stop working.

- platform: command_line
    name: Manly Sea Temperature
    command: "curl -s 'https://api.manly.hydraulics.works/api.php?page=latest-readings&sitecode=SYDDOW&username=publicwww&token=eE9lT0RFaGVzbk1PZS9ZSEQzVzUxbFVHTi84cUI0VHFiNEdTTjVIMlVIYmVnWndsNWVRUEhieXM5MlZzalpQYkVlRzJ1SDVQeFVIZGphcGRtNFdMaXE4eG5hZG1xeklFU2huT2pJRzFDOTF1Y1pyY0UybmJrbHVhN3B6bmpLWENrR2NsM3RBNXRIZnNSOXUzVTBoME5CeURhL0lJa0s2YXJJTXdpY0JqdjdLQzUxSElHOVZtOEp2Q2llYStoRzJJQWhmaHlNYytZbXVXdWcwY0VldDVyTExnRzcxTitoNWdYVElUaEJ4MVNnb3Y2MThZS2xyVXh1a1BFSS9ibFRTbUhETkVwVVVwczF1WGlKVFBibnF4YVNjck9Ea1k3ZkYwV1ZIeTk2cnBXWGlnL3E4VUl2bnZiQ3hXUnh4R25tS2o%3D' 
@shermozle
shermozle / covid-numbers.md
Created September 7, 2020 10:53
Get Australian COVID-19 numbers into Home Assistant

Show COVID-19 numbers in Home Assistant

Using Juliette's amazing COVID-19 Data site to chart numbers in Home Assistant. Inspired by Rob Kingston's gist as tweeted.

1. Add CLI sensors

  - platform: command_line
    name: NSW new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][1] | tonumber'"
    unit_of_measurement: cases
@shermozle
shermozle / get6musicMetadata.py
Created April 2, 2020 22:59
Script to grab 6music "what's playing" info and update an Icecast stream's metadata
#!/usr/bin/python
import urllib, json, re, time
count = 0
sleep_timer = 10
while count <=5:
try:
clients = urllib.urlopen('http://admin:PASSWORD@192.168.1.128:8000/admin/listclients?mount=/6music')
define("idcta-v2/logger", [], function() {
var e = {};
return e.logCaughtError = function(e) {
window.console && e.message && console.log(e)
}, e.logMessage = function(e) {
document.cookie.match(new RegExp("ckns_debugtoken=([^;]+)")) && (window.tokenRefeshLog = window.tokenRefeshLog || [], window.tokenRefeshLog.push(e))
}, e
}), define("idcta-v2/optional", ["idcta-v2/logger"], function(e) {
var t = {};
return t.load = function(t, r, n) {
;
(function() {
var dfltPluginCfg = {
"sourceFile": "download",
"info": true
};
var dfltGlobalCfg = {
"site": 596068,
"log": "",
"logSSL": "",
! function o(n, u, s) {
function l(r, e) {
if (!u[r]) {
if (!n[r]) {
var t = "function" == typeof require && require;
if (!e && t) return t(r, !0);
if (d) return d(r, !0);
var a = new Error("Cannot find module '" + r + "'");
throw a.code = "MODULE_NOT_FOUND", a
}
/* dd: 2019-09-11__05-31-14 */
/* version: 2.12.0.5273.b96c35cc Wed Jul 03 2019 15:53:11 */
new function a() {
"use strict";
var e, t, n, r, i, o, s, u, c, h, l, d, f, _, p, g, v, m, y, w, S, b, E, k, C, T, M, D, R, x, F, A, P, L, I, U, B, N, O, W, Q, H, z, q, j, V, Y, K, G, X, Z, J, $, ee, te, ne, ie, se, re, ae, oe, ue, ce, he, le, de, fe, _e, pe, ge, ve, me, ye, we, Se, be, Ee, ke, Ce, Te, Me, De, Re, xe, Fe, Ae, Pe, Le, Ie, Ue, Be, Ne, Oe, We, Qe, He, ze, qe, je, Ve, Ye, Ke, Ge, Xe, Ze, Je, $e, et, tt, nt, it, st, rt, at, ot, ut, ct, ht, lt, dt, ft, _t, pt, gt, vt, mt, yt, wt, St, bt, Et, kt, Ct, Tt, Mt, Dt, Rt, xt, Ft, At, Pt, Lt, It, Ut, Bt, Nt, Ot, Wt, Qt, Ht, zt, qt, jt, Vt, Yt, Kt, Gt, Xt, Zt, Jt, $t, en, tn, nn, sn, rn, an, on, un, cn, hn, ln, dn, fn, _n, pn, gn, vn, mn, yn, wn, Sn, bn, En, kn, Cn, Tn, Mn, Dn, Rn = this,
xn = function() {
function i(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];

Keybase proof

I hereby claim:

  • I am shermozle on github.
  • I am shermozle (https://keybase.io/shermozle) on keybase.
  • I have a public key ASCdV7bTpWuvsnUAXwuPmHJJ8oTCtVUj_hpk4-XgXcQlbwo

To claim this, I am signing this object: