Skip to content

Instantly share code, notes, and snippets.

@efrecon
efrecon / docker_tags.md
Last active February 8, 2024 13:19
Get tags for Docker registry image

Docker Tags

[DEPRECATED] Active as a real project instead, development as a gist has been discontinued.

This "script" implements a single function to list the existing tags at the Docker [hub] for a given public image.

@efrecon
efrecon / unsecret.md
Last active September 9, 2020 20:15
read environment variables from files and start sub-process

unsecret

[DEPRECATED] Active as a real project instead, development as a gist has been discontinued.

Unsecret is an inverted wrapper: It will arrange to set the value of one or several environment variables from the content of files before starting a program. This is useful when you have a Docker image that can only be configured

@efrecon
efrecon / cleaner.md
Last active June 5, 2019 21:57
Clean old files

Cleaner for Backups

cleaner.sh is a script to keep a finite number of backup (files) matching a pattern. It should be scheduled on a regular basis from the outside, e.g. with cron.

Options

cleaner.sh takes a number of single or double-dashed options, possibly followed by a command to execute once the removal operations have ended. It is

@efrecon
efrecon / tar.md
Last active May 6, 2020 14:38
date-based tar for backups

Tar-Wrapper for Backups

This is a simple wrapper around tar to manage a number of backups for sources into a destination directory. The destination directory will automatically be created and this wrapper will create files which names contain the time and date of the backup. The resulting tar files will automatically be compressed using gzip compression for maximal compatibility across architectures. The utility is able to execute a command once the backup operation has finalised. One new tar file is created every time tar.sh is run, meaning that it should probably be scheduled on a regular basis from the outside, e.g. with cron.

@efrecon
efrecon / chopper.md
Last active February 1, 2023 22:44
Automatically chops SenML data and send it in chunks to remote MQTT topics

Chopper

The prupose of this module is to help chopping SenML into smaller chunks and to automatically send chunks away via MQTT as soon as a number of entries have been collected (the chopping size). Data is collected per MQTT topic to send to. The module is tuned to be used from inside logic behind projects such as http2mqtt or mqtt2any.

@efrecon
efrecon / mirror.md
Last active February 1, 2019 13:57
Continuous mirroring between directories

Directory Mirroring

This script will mirror/backup the latest directories/files matching a glob-style pattern in a directory to another one. It is able to only keep a number of copies in the destination and to skip some items from the source. The script is able to perform the mirror operation on and on, making it suitable for situations where access to cron is not an option.

Command-Line Options

Disque to Influx Pusher

The aim of this single-file project is to automatically [influx] updates from [Disque] jobs picked from a cluster and queue. The implementation is meant to be given as part of the configuration of the generic [disque2any] bridge. The assumption made by this project is that jobs are composed of JSON objects directly serialised to [SenML] or where one of the fields contains [SenML]. When [SenML] data is a field in the JSON object, other fields can be pushed as tags when pushing to the Influx database. For proper operation, this project depends on the [json] package from tcllib. When the [SenML][lib] library is available,

@efrecon
efrecon / mqtt2disque.md
Last active April 26, 2019 21:44
Automatically push jobs into Disque from MQTT JSON data

MQTT to Disque Pusher

The aim of this single-file project is to automatically create [Disque] jobs from data that is being pushed to an MQTT broker. The implementation is meant to be given as part of the configuration of the generic [mqtt2any] bridge. The assumption made by this project is that you use your MQTT topic hierarchy in a REST-routing like manner: the project will be able to extract the value of some fields between the slashes / of the MQTT topic hiearchy and to copy their values into the job data that is created at the remote [Disque] server. For proper operation, this project depends on [disque], the Tcl implementation of

@efrecon
efrecon / influx-init.md
Last active November 14, 2018 10:28
Easy InfluxDB initialisation

UNIX-Style InfluxDB Initialisation

Introduction

This script aims at easily initialising access rights for users in InfluxDB databases in a UNIX:y way. The script will read a configuration file where fields are separated by the colon (:) sign (e.g. analogical to /etc/password). The file is able to express and map rwx-style permissions onto GRANT-style privileges with the database, thus simplifying initialisation of the authorisations, but also use of users created in other parts of a cloud

@efrecon
efrecon / postgres-init.md
Last active December 17, 2018 22:13
Initialise auth. and permissions in postgreSQL dbs

UNIX-Style postgreSQL Initialisation

Introduction

This script aims at easily initialising access rights for users in postgreSQL databases in a UNIX:y way. The script will read a configuration file where fields are separated by the colon (:) sign (e.g. analogical to /etc/password). The file is able to express and map rwx-style permissions onto GRANT-style privileges with the database and its schema/tables, thus simplifying initialisation of the authorisations, but also use of users created