Skip to content

Instantly share code, notes, and snippets.

Avatar

Dale Higgs dale3h

View GitHub Profile
@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 / autocopy.sh
Created Aug 27, 2020
[unRAID] Auto-Copy for Unassigned Devices Plugin
View autocopy.sh
#!/usr/bin/env bash
################################################################
# Auto-Copy Script for unRAID Unassigned Devices Plugin
# Original script: https://gitlab.com/snippets/1737763
################################################################
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
# Available variables:
#
@dale3h
dale3h / custom-quickbar.js
Last active Aug 26, 2021
[Home Assistant] Lovelace Custom QuickBar Commands
View custom-quickbar.js
customElements.whenDefined("ha-quick-bar").then(() => {
const fireEvent = (node, type, detail, options) => {
options = options || {};
detail = detail === null || detail === undefined ? {} : detail;
const event = new Event(type, {
bubbles: options.bubbles === undefined ? true : options.bubbles,
cancelable: Boolean(options.cancelable),
composed: options.composed === undefined ? true : options.composed,
});
event.detail = detail;
@dale3h
dale3h / gitter-backup.sh
Created May 17, 2017
Perform local backups of Gitter.im chat rooms.
View gitter-backup.sh
#!/bin/bash
#
# Perform local backups of Gitter.im chat rooms.
GITTER_ARCHIVE_URL="https://gitter.im/%s/archives/%s"
usage() {
echo "usage: $(basename $0) -f -r <chat-room> [-o <output-dir>] [-s <YYYY/MM/DD>] [-e <YYYY/MM/DD>]" 1>&2
exit 1
}
@dale3h
dale3h / automations.yaml
Created May 15, 2019
[Home Assistant] Webhook Debugger
View automations.yaml
# Webhook URL: https://[your-hass-domain]/api/webhook/2qDFuSEBA7jU2sNjaK6JD5ac3FxnGfVTSF
- id: webhook_debugger
alias: "Webhook Debugger"
trigger:
- platform: webhook
webhook_id: 2qDFuSEBA7jU2sNjaK6JD5ac3FxnGfVTSF
action:
- service: persistent_notification.create
data_template:
@dale3h
dale3h / card-level.yaml
Created Sep 11, 2019
[Lovelace] Style entity icons based on state
View card-level.yaml
# It should be possible to add these CSS variables to your
# frontend theme instead of in the card configuration.
- type: glance
title: Network Devices
columns: 4
show_icon: true
show_name: true
show_state: false
style:
@dale3h
dale3h / automations.yaml
Created Dec 2, 2020
[Home Assistant] Restart Time
View automations.yaml
################################################################
# Automations / Restart Time
# Publish timestamps to MQTT broker on start and shutdown.
################################################################
- id: restart_time_start
alias: Publish Start Time
description: Publish current timestamp to MQTT broker on startup.
mode: single
trigger:
@dale3h
dale3h / example.conf
Created Nov 8, 2020
[Shell] SSHFS Mount Utilities
View example.conf
remote_user=pi
remote_host=192.168.1.100
remote_path=/home/pi
remote_port=22
@dale3h
dale3h / ha-sidebar-concealer.user.js
Last active Nov 8, 2020
[Userscript] Home Assistant Sidebar Concealer
View ha-sidebar-concealer.user.js
// ==UserScript==
// @name Home Assistant Sidebar Concealer
// @namespace https://dale3h.com
// @version 0.1.0
// @icon https://raw.githubusercontent.com/home-assistant/assets/master/logo-round.svg
// @match https://example.duckdns.org/a0d7b954_vscode*
// @match https://example.duckdns.org/a0d7b954_adguard*
// ==/UserScript==
let counter = 0;
@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