Skip to content

Instantly share code, notes, and snippets.

View blizzrdof77's full-sized avatar

Ben Wagner blizzrdof77

View GitHub Profile
@tdiekel
tdiekel / automatic-turn-off.yaml
Last active January 12, 2024 02:14 — forked from JonTheNiceGuy/Turn Off Light After Time.yaml
Automatic light or switch turn off after time
blueprint:
name: Automatic light or switch turn off after time
description: 'Given a light entity, watch for it turning on, and then turn it off after a certain period of time.
Based on [Turn Off Light After Time](https://gist.github.com/JonTheNiceGuy/5ac636739165dd593030c0fed16eb618)
by JonTheNiceGuy'
domain: automation
input:
light_or_switch:
name: Light or switch
description: Select the light or switch to monitor and control
@blizzrdof77
blizzrdof77 / strmod
Last active August 26, 2023 21:41
String Modification Utility
#!/usr/bin/env bash
script_name='strmod'
script_title='String Modification Utility'
version=0.44.0
updated='2023-08-25'
if [ -f "$(which batcat)" ] && [ ! -z "$(which batcat)" ] && [ -z "$(which bat)" ]; then
BatCat="$(command -v batcat) --language=Manpage"
elif [ -f "$(which bat)" ] && [ ! -z "$(which bat)" ]; then
blueprint:
name: Turn off Light after Time has elapsed
description: Given a light entity, watch for it turning on, and then turn it off after a certain period of time.
domain: automation
input:
light:
name: Light
description: Select the light to monitor and control
selector:
entity:
@jonlabelle
jonlabelle / Get-Basename.ps1
Last active October 11, 2023 05:21
Gets the file name or directory portion of a path. Similar (but not exact) to the posix BASENAME(1) command, written in PowerShell.
function Get-Basename
{
<#
.SYNOPSIS
Gets the file name or directory portion of a path.
Somewhat similar to the POSIX BASENAME(1) command, written in PowerShell.
.DESCRIPTION
The Get-Basename cmdlet strips any prefix ending with the last slash
character present in string (after first stripping trailing slashes),
@dale3h
dale3h / custom-quickbar.js
Last active August 26, 2021 17:57
[Home Assistant] Lovelace Custom QuickBar Commands
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;
@balloob
balloob / panel-redirect.js
Created June 22, 2020 04:51
Add redirects to the Home Assistant sidebar to any place in Home Assistant
/*
Add a link to the sidebar to any path in Home Assistant
Put this file in <config>/www/panel-redirect.js
In configuration.yaml:
panel_custom:
- name: panel-redirect
# url_path needs to be unique for each panel_custom config
@blizzrdof77
blizzrdof77 / TP-Link Smart Plug Web Client Vendor Scripts
Last active August 22, 2018 06:25
TP-Link Smart Plug Web Client
@blizzrdof77
blizzrdof77 / String.prototypeHelpers.js
Last active September 19, 2022 20:02
Javascript String Prototype Helper Methods
/**
* Helper String Methods/Extensions to the JS String Object
*
* @param String search
* @return Bool
*/
/* Easier way to check if a string contains a substring */
String.prototype.contains = String.prototype.contains || function(search) {
return (this.indexOf(search) !== -1);
@blizzrdof77
blizzrdof77 / namei-simple
Created November 29, 2017 06:58
Short/simple output of namei
#!/bin/bash
[[ $# -eq 1 ]] || exit 1
FILEPATH="$1"
while true ; do
ls -ld "$FILEPATH"
[[ "$FILEPATH" != "/" ]] || exit
FILEPATH="$( dirname "$FILEPATH" )"