Skip to content

Instantly share code, notes, and snippets.

68, 71, 74, 77, 79, 82, 85, 89, 92, 95, 98, 101, 105, 108, 112, 115,
119, 122, 126, 130, 134, 137, 141, 145, 149, 153, 157, 160, 164, 168, 172, 176,
180, 184, 187, 191, 195, 198, 202, 206, 209, 212, 216, 219, 222, 225, 228, 230,
233, 236, 238, 240, 242, 244, 246, 248, 249, 250, 252, 252, 253, 254, 254, 255,
255, 255, 254, 254, 253, 253, 252, 250, 249, 248, 246, 244, 242, 240, 238, 236,
233, 230, 228, 225, 222, 219, 216, 212, 209, 206, 202, 199, 195, 191, 187, 184,
180, 176, 172, 168, 164, 161, 157, 153, 149, 145, 141, 137, 134, 130, 126, 123,
119, 115, 112, 108, 105, 102, 98, 95, 92, 89, 86, 82, 80, 77, 74, 71,
68, 66, 63, 61, 58, 56, 54, 51, 49, 47, 45, 43, 41, 39, 37, 36,
34, 32, 31, 29, 28, 26, 25, 23, 22, 21, 20, 18, 17, 16, 15, 14,
@thomo
thomo / datetime2epoch.lua
Last active September 1, 2023 17:49
Convert from human readable date/time to epoch timestamp
-- The MIT License (MIT)
-- Copyright (c) 2018,2020 Thomas Mohaupt <thomas.mohaupt@gmail.com>
-- year: 2-digit (means 20xx) or 4-digit (>= 2000)
function datetime2epoch(second, minute, hour, day, month, year)
local mi2sec = 60
local h2sec = 60 * mi2sec
local d2sec = 24 * h2sec
-- month to second, without leap year
local m2sec = {
@thomo
thomo / init.lua
Last active November 29, 2021 15:17
NodeMCU init.lua with interrupt opportunity
-- Tested with
-- NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
-- branch: release
-- commit: d4ae3c364bd8ae3ded8b77d35745b7f07879f5f9
-- release:
-- release DTS: 202105102018
-- SSL: false
-- build type: float
-- LFS: 0x0 bytes total capacity
-- modules: bit,file,gpio,net,node,spi,tmr,uart,ucg,wifi
@thomo
thomo / user.lua
Last active November 28, 2021 11:07
Wifi Scanner with ESP8266 + TFT ST7735B (NodeMCU)
-- Tested with
-- NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
-- branch: release
-- commit: d4ae3c364bd8ae3ded8b77d35745b7f07879f5f9
-- release:
-- release DTS: 202105102018
-- SSL: false
-- build type: float
-- LFS: 0x0 bytes total capacity
-- modules: bit,file,gpio,net,node,spi,tmr,uart,ucg,wifi
@thomo
thomo / mbmdmqtt2influx.conf
Created October 12, 2020 22:36
telegraf config to transform mbmd mqtt messages
# 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 October 12, 2020 19:58
Grafana PV Dashboard
{
"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 October 12, 2020 19:28
PV Calculation
[
{
"id": "8fac7d4.a8d298",
"type": "tab",
"label": "PV",
"disabled": false,
"info": ""
},
{
"id": "83528e7.dc0fc7",
@thomo
thomo / build.gradle
Created March 20, 2020 22:13
Run cucumber with gradle with tags support
plugins {
id 'java'
}
repositories {
jcenter()
mavenLocal()
}
def cucumberVersion = '5.5.0'
@thomo
thomo / build-wlan-module.sh
Last active March 13, 2020 12:46
Bash script to build a Broadcom Wireless kernel module for CentOS 7 using a Docker container - see http://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom
#!/bin/sh
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SDIR=${DIR}/src
DRIVER_SRC=`ls ${DIR}/hybrid*.tar.gz 2> /dev/null`
CONTAINER="thomo/centos7-dev:latest"
MYUID=`id -u`
MYGID=`id -g`
@thomo
thomo / more-without-comments.sh
Last active January 3, 2020 08:50
An alias to show only the relevant lines in (most) linux config files - just skip typical comment and empty lines.
alias mwc='grep -v -e '\''^;'\'' -e '\''^[[:space:]]*#'\'' -e '\''^[[:space:]]*$'\'''