Skip to content

Instantly share code, notes, and snippets.

@thomo
thomo / mbmdmqtt2influx.conf
Created Oct 12, 2020
telegraf config to transform mbmd mqtt messages
View mbmdmqtt2influx.conf
# send messages with database-tag = mbmd to influxdb mbmd
[[outputs.influxdb]]
urls = ["http://influxdb.host:8086"]
database = "mbmd"
tagexclude = ["influxdb_database", "src", "measurement"]
[outputs.influxdb.tagpass]
influxdb_database = ["mbmd"]
###########################################################################################
@thomo
thomo / pv_dashboard.json
Created Oct 12, 2020
Grafana PV Dashboard
View pv_dashboard.json
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@thomo
thomo / pv_flow.json
Created Oct 12, 2020
PV Calculation
View pv_flow.json
[
{
"id": "8fac7d4.a8d298",
"type": "tab",
"label": "PV",
"disabled": false,
"info": ""
},
{
"id": "83528e7.dc0fc7",
@thomo
thomo / build.gradle
Created Mar 20, 2020
Run cucumber with gradle with tags support
View build.gradle
plugins {
id 'java'
}
repositories {
jcenter()
mavenLocal()
}
def cucumberVersion = '5.5.0'
@thomo
thomo / more-without-comments.sh
Last active Jan 3, 2020
An alias to show only the relevant lines in (most) linux config files - just skip typical comment and empty lines.
View more-without-comments.sh
alias mwc='grep -v -e '\''^;'\'' -e '\''^[[:space:]]*#'\'' -e '\''^[[:space:]]*$'\'''
@thomo
thomo / example.yaml
Created Oct 29, 2019
Solution to using numbered backreference followed by digit in lineinfile
View example.yaml
---
- hosts: localhost
tasks:
- name: create file
copy: src=./demo dest=/tmp/demo
# not working as expected
- name: update xxxx
lineinfile:
dest: /tmp/demo
View example_multiprocessing.py
import collections
import multiprocessing
import time
startzeit = time.time()
Scientist = collections.namedtuple('Scientist', [
'name',
'born',
])
@thomo
thomo / mkdir-tmpfs
Created Feb 21, 2019
Creates necessary directories in tmpfs mount points
View mkdir-tmpfs
#!/bin/sh
### BEGIN INIT INFO
# Provides: mkdir-tmpfs
# Required-Start: mountall
# Required-Stop:
# Should-Stop:
# X-Start-Before:
# Default-Start: 1 2 3 4 5
# Default-Stop:
@thomo
thomo / jquery.feedToJSON.js
Created Feb 11, 2019
Patch retired Yahoo yql API in MagicMirror v1
View jquery.feedToJSON.js
//jQuery extension to fetch an rss feed and return it as json via YQL
//created by dboz@airshp.com
(function($) {
$.extend({
feedToJson: function(options, callback) {
if ($.isFunction(options)) {
callback = options;
options = null;
}
@thomo
thomo / isDateTimeValid.lua
Created Mar 30, 2018
Small function to verify validity of datetime (to use with https://gist.github.com/thomo/8ac2bceb6400eb8868c651e8897be958)
View isDateTimeValid.lua
function isDateTimeValid(second, minute, hour, day, month, year)
function check(x, xmin, xmax)
return x >= xmin and x <= xmax
end
return check(second, 0, 59) and check(minute, 0, 59) and check(hour, 0, 23) and
check(day, 1, 31) and check(month, 1, 12) and check(year, 0, 99)
end
You can’t perform that action at this time.