Skip to content

Instantly share code, notes, and snippets.

@jceloria
jceloria / create_repos.sh
Created September 20, 2018 00:02
repo sync
#!/usr/bin/env bash
SELF=${0##*/} SDIR=${0%/*}
########################################################################################################################
######################################################## config ########################################################
# Set some defaults
VERSION=0.3
CENTOS_RELEASE="7"

Python Number Conversion Chart

From To Expression
@jceloria
jceloria / container-telegraf.service
Created May 21, 2018 19:50
telegraf in Docker container
[Unit]
Description=telegraf in Docker container
After=docker.service container-influxdb.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop telegraf
ExecStartPre=-/usr/bin/docker rm telegraf
@jceloria
jceloria / container-influxdb.service
Created May 21, 2018 19:50
influxdb in Docker container
[Unit]
Description=influxdb in Docker container
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop influxdb
ExecStartPre=-/usr/bin/docker rm influxdb
@jceloria
jceloria / container-grafana.service
Created May 21, 2018 19:50
grafana in Docker container
[Unit]
Description=grafana in Docker container
After=docker.service container-influxdb.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop grafana
ExecStartPre=-/usr/bin/docker rm grafana
@jceloria
jceloria / telegraf-arris.py
Created May 21, 2018 19:37
Telegraf input plugin for Arris TM1602AP2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################################################################
"""
Telegraf input plugin for Arris TM1602AP2
Copyright © 2018 by John Celoria.
@jceloria
jceloria / telegraf-moto.py
Last active December 28, 2017 15:22
Telegraf input plugin for Motorola Surfboard 6141
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################################################################
"""
Telegraf input plugin for Motorola Surfboard 6141
Copyright © 2017 by John Celoria.
@jceloria
jceloria / get-hass-states.sh
Last active December 28, 2017 15:23
Home Assistant API info from the commandline
#!/usr/bin/env bash
SELF=${0##*/} SDIR=${0%/*}
########################################################################################################################
# Get home-assistant states
#
# Copyright © 2017 by John Celoria.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@jceloria
jceloria / es.sh
Last active January 5, 2018 19:35
bash functions for ES
########################################################################################################################
# Common Elasticsearch functions
function es() {
local id=$1; shift; local cmd=$1; shift; local connect region json curl="$(type -P curl) -sL --netrc-file ~/.netrc-es"
local actions=(aliases allocation health indices nodes recovery shards settings stats clear-cache)
local regex="+(*$(IFS='|';echo "${actions[*]}"|sed 's/|/|*/g'))"
function _help() {
echo "Usage: es <id> ${regex##*+}" >&2
@jceloria
jceloria / retry-ssh.sh
Last active March 27, 2017 15:11
ssh wrapper to continuously retry if unavailable
########################################################################################################################
# ssh wrapper to continuously retry if unavailable
function ssh() {
local next prev host port
for ((i=1;i<=$#;++i)); do
next=$((i+1)); [[ $((i-1)) -eq 0 ]] || prev=$((i-1))
case "${!i}" in
-p*) [[ "${!i}" =~ -p$ ]] && port=${!next} || port=${!i//-p} ;;
*@*) host=${!i##*@} ;;
-*) true ;;