Skip to content

Instantly share code, notes, and snippets.

Avatar

Dale Higgs dale3h

View GitHub Profile
@dale3h
dale3h / telnet-wrapper.sh
Created Apr 19, 2018
[Home Assistant] Hass.io - Install Packages and Execute Telnet Command
View telnet-wrapper.sh
#!/bin/bash
################################################################
## @usage telnet-wrapper.sh "uptime"
## @usage telnet-wrapper.sh "ping -c1 10.0.0.2"
## @description Install Alpine packages and run telnet command
## @license MIT
## @author Dale Higgs <@dale3h>
################################################################
@dale3h
dale3h / clog
Created Apr 19, 2018
[Hass.io] Colored Log Viewer for Home Assistant
View clog
#!/bin/bash
################################################################
## @usage clog folder_watcher=magenta,system_log=red
## @colors https://www.npmjs.com/package/colors#text-colors
## @license MIT
## @author Dale Higgs <@dale3h>
################################################################
[[ -n "$(command -v apk)" ]] \
@dale3h
dale3h / pkg-x
Last active Dec 4, 2018
Ensure Alpine packages are installed and then run a command
View pkg-x
#!/bin/bash
################################################################
## @usage pkg-x node=nodejs node /my/node-script.js "arg1" "arg2"
## @usage pkg-x expect,telnet=busybox-extras /path/to/telnet.sh "uptime"
## @description Ensure Alpine packages are installed and then run a command
## @license MIT
## @author Dale Higgs <@dale3h>
################################################################
@dale3h
dale3h / toggle_with_brightness.yaml
Last active Apr 26, 2018
Light Toggle w/ Brightness (@MattW)
View toggle_with_brightness.yaml
################################################################
## Packages / Light Toggle with Brightness
##
## @description Toggle lights with a brightness based on time
## @component automation, binary_sensor, light
## @license MIT
## @author @mattlward, Dale Higgs <@dale3h>
################################################################
automation:
@dale3h
dale3h / motion_lights_off.yaml
Created Apr 27, 2018
Delay and transition lights off after motion is no longer detected
View motion_lights_off.yaml
################################################################
## Packages / Motion Lights Off
##
## @description Delay and transition lights off after motion is no longer detected
## @component automation, binary_sensor, input_number, light, sensor
## @license MIT
## @author @Vasiley, Dale Higgs <@dale3h>
################################################################
homeassistant:
@dale3h
dale3h / lovelace-migrate.py
Created Jun 29, 2018
Lovelace UI Migration Script
View lovelace-migrate.py
"""
Migration tool for Home Assistant Lovelace UI.
"""
import argparse
import logging
import sys
import json
from collections import OrderedDict
from getpass import getpass
@dale3h
dale3h / jail.local
Created Jun 29, 2018
[fail2ban] Improved nginx-badbots
View jail.local
# Add to file: /etc/fail2ban/jail.local
[nginx-badbots]
enabled = true
port = http,https
filter = nginx-badbots
logpath = %(nginx_access_log)s
maxretry = 1
findtime = 604800
bantime = 604800
@dale3h
dale3h / ui-lovelace.yaml
Created Jul 23, 2018
[Lovelace] Create a header by using `panel: true` with nested stack cards
View ui-lovelace.yaml
title: Home
views:
- title: Header
icon: mdi:car
panel: true
cards:
- type: vertical-stack
cards:
- type: glance
entities:
@dale3h
dale3h / ui-lovelace.yaml
Created Jul 28, 2018
[Lovelace] How to Duplicate a Lovelace Card
View ui-lovelace.yaml
title: Home
views:
- title: View 1
cards:
- &card1
type: entities
title: Card 1
show_header_toggle: false
entities:
- light.bedroom
@dale3h
dale3h / MessageForwarding_StreamlabsSystem.py
Created Aug 17, 2018
Streamlabs Message Forwarding [Twitch <-> Discord] (Author: Castorr91)
View MessageForwarding_StreamlabsSystem.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
"""Forward messages from twitch chat to discord chat or the other way around"""
#---------------------------------------
# Libraries and references
#---------------------------------------
import codecs
import json
import os