Skip to content

Instantly share code, notes, and snippets.

View ties's full-sized avatar

Ties de Kock ties

  • The Netherlands
View GitHub Profile
@ties
ties / docker-compose.apps.yml
Last active December 8, 2018 21:20
Traefik/Docker
version: '3'
services:
# [...]
# A LAN-only container:
iot-grafana:
image: grafana/grafana
restart: unless-stopped
networks:
iot:
#
# Lenovo Throttle Fix configuration for my HP Zbook Studio G5
# (undervolt settings are motherboard dependent and will likely not
# apply to your system.)
#
# Fixes the 15W/35W throttling issue in Linux :)
#
[GENERAL]
# Enable or disable the script execution
Enabled: True
@ties
ties / line_uglify.py
Created November 13, 2018 13:43
Uglify (mix) line endings. Creates incompatible files.
"""
Replace line endings by 'mixed' line endings.
Behaviour is untested
"""
import argparse
import random
from typing import TextIO
import sys
"""
Quite quick, quite dirty search script for RIPTE db
"""
import aiohttp
import asyncio
import json
import itertools
import netaddr
version: '3'
#
# Config for powerdns is saved in /opt/powerdns/
#
# Take pdns.conf from https://raw.githubusercontent.com/psi-4ward/docker-powerdns/master/pdns.conf
# and create /opt/powerdns/pdns/conf.d/api.conf with
#
# api=yes
# api-key=6d238bb754ffe84d9b1fdc967cb16a546ea7a32cdd2438497912137440bd0c75
# webserver-address=0.0.0.0
/**
* Regular expressions in javascript...
*
* Given that
*/
'abc'.match(new RegExp('ab.'));
// returns what is logged by
console.log([ 'abc', index: 0, input: 'abc' ])
// and
'abc'.match(new RegExp('mis'))
// @flow
//
// flow-annotated variant of https://github.com/izaakschroeder/cartesian-product
//
function product<T>(...elements: $ReadOnlyArray<$ReadOnlyArray<T>>): $ReadOnlyArray<$ReadOnlyArray<T>> {
const end = elements.length - 1;
const result: Array<Array<T>> = [];
function addTo(curr: Array<T>, start: number) {
const first = elements[start];
product month sales
Product A 2017-12 0
Product A 2018-01 36
Product A 2018-02 27
Product A 2018-03 45
Product A 2018-04 46
Product A 2018-05 41
Product A 2018-06 59
Product A 2018-07 53
Product A 2018-08 67
# /etc/telegraf/telegraf.d/mqtt_consumer.conf
# Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
servers = ["localhost:1883"]
## MQTT QoS, must be 0, 1, or 2
qos = 0
## Topics to subscribe to
topics = [
"telegraf/host01/cpu",