Skip to content

Instantly share code, notes, and snippets.

View webartoli's full-sized avatar

Claudio Bartoli webartoli

View GitHub Profile
@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

@webartoli
webartoli / README.md
Last active December 20, 2021 20:38
Home assistant - appdeamon - deconz - IKEA tradfri remote control

Home Assistant - Reuse dimming logic using AppDaemon

I have a multiple IKEA tradfri remotes attached to deconz and I want write once the logic to dim lights.

After some searches I discover the AppDaemon solution and this is the results of my draft works.

Install

I have installed the plugin provided by community addons

@webartoli
webartoli / install.sh
Last active December 22, 2015 21:34
New Mac
#!/bin/bash
# Install Command Line Tool
xcode-select --install
# Install Theme
# https://github.com/stephenway/monokai.terminal
# https://github.com/lysyi3m/osx-terminal-themes/tree/master/schemes
# Install HomeBrew
@webartoli
webartoli / keybindings.json
Last active January 3, 2022 09:47
Visual Studio Code - IntelliJ keybindings Scheme
// file: keybindings.json
// path: AppData\Roaming\Code\User
// Author: Claudio Bartoli
// Mail: claudio@barto.li
// --------------------------------------------
// Resharper 9 Default Keymap - IntelliJ Scheme
// --------------------------------------------
[
{ "key": "ctrl+d", "command": "editor.action.copyLinesDownAction",