Skip to content

Instantly share code, notes, and snippets.

View webartoli's full-sized avatar

Claudio Bartoli webartoli

View GitHub Profile
@webartoli
webartoli / ha-conditional-dimmer.yaml
Created April 21, 2025 08:31
Home Assistant / Conditional Dimming
blueprint:
name: Azioni Condizionate su Input Select
description: Esegue azioni solo se il valore di un input_select corrisponde a un valore atteso. Utilizza trigger multipli per le azioni "up" e "down".
domain: automation
input:
input_select:
name: Input Select
description: L'input_select da monitorare.
selector:
entity:
blueprint:
name: Rotazione Circolare Input Select con Reset
description: Esegue una rotazione circolare di un input_select utilizzando multipli trigger definiti dall'utente per le azioni "up" e "down", e reimposta il valore di default dopo un tempo specificato.
domain: automation
input:
input_select:
name: Input Select
description: L'input_select da ruotare.
selector:
entity:
@webartoli
webartoli / dailytoast.io.js
Last active February 19, 2025 10:09
Dailytoast.io key handler
// paste this snippet in your browser bookmark url
javascript: (function () {
function clickIfVisible(selector) {
var element = document.querySelector(selector);
if (element && element.offsetParent !== null) {
element.click();
return true;
}
return false;
}
@webartoli
webartoli / zha-aqara-wireless-switch-WXKG02LM.yaml
Last active March 1, 2024 20:56
ZHA - Aqara Wireless Double Rocker WXKG02LM
blueprint:
name: ZHA - Aqara Wireless Double Rocker WXKG02LM
description:
Automate your Xiaomi Aqara Wireless Double Rocker WXKG02LM using ZHA
events.
domain: automation
input:
aqara_switch:
name: Select the switch
description: Aqara Wireless Double Rocker WXKG02LM
@webartoli
webartoli / Identify row univocally.EXCEL.yaml
Created October 19, 2022 09:07
This snippet is trying to find out a way to identify row changes
name: Identify row univocally
description: This snippet is trying to find out a way to identify row changes
host: EXCEL
api_set: {}
script:
content: >+
//
################################################################################
// #### UTILS and Handlers
@webartoli
webartoli / InitDbXunit.cs
Created June 28, 2022 18:04
Init Db with Xunit
public class InMemoryDbInstance
{
public InMemoryDbInstance()
{
Data = "";
}
public string Data { get; set; }
}
@webartoli
webartoli / Data validation.EXCEL.yaml
Created September 17, 2021 14:41
Sets data validation rules on ranges, prompts users to enter valid data, and displays messages when invalid data is entered.
name: Data validation
description: >-
Sets data validation rules on ranges, prompts users to enter valid data, and
displays messages when invalid data is entered.
host: EXCEL
api_set: {}
script:
content: |
$("#require-approved-location").click(() => tryCatch(requireApprovedName));
@webartoli
webartoli / dockerfile-deps-graph-gen.sh
Created September 6, 2021 16:41
Generate deps graph from multistage Dockerfile
#!/usr/bin/env bash
function extract_key_value() {
egrep -o "$1[:=]['\"[:alnum:]\-]+" | egrep -o "['\"[:alnum:]\-]+$" | egrep -o "[[:alnum:]\-]+"
}
function docker_multistage_deps() {
cat Dockerfile \
| grep -i 'FROM ' \
| grep -i ' AS ' \
@webartoli
webartoli / machine.js
Created February 1, 2021 09:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@webartoli
webartoli / docker-cleanup-resources.md
Created January 29, 2019 21:43 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm