Skip to content

Instantly share code, notes, and snippets.

! 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
}
;
(function() {
var dfltPluginCfg = {
"sourceFile": "download",
"info": true
};
var dfltGlobalCfg = {
"site": 596068,
"log": "",
"logSSL": "",
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) {
@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')
@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 / 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' 
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 / 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))