Skip to content

Instantly share code, notes, and snippets.

@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 / 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

Python Number Conversion Chart

From To Expression
@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"
@jceloria
jceloria / docker-nginx-rtmp.sh
Created October 3, 2018 21:36
setup nginx-rtmp in docker/systemd
#!/usr/bin/env bash
SELF=${0##*/} SDIR=${0%/*}
########################################################################################################################
: '
The MIT License (MIT)
Copyright © 2018 by John Celoria.
Permission is hereby granted, free of charge, to any person obtaining a copy
@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 / alarm_clock.yaml
Created February 25, 2019 17:52
alarm clock package in HA
---
# ############################################################################ #
# ### ALARM CLOCK PACKAGE #################################################### #
group:
# -------------------------------------------------------------------------- #
alarm_clock:
name: Alarm Clock
entities: