Skip to content

Instantly share code, notes, and snippets.

@wujku
wujku / traefik-auth.conf
Created March 6, 2021 12:56 — forked from DiscoYeti/traefik-auth.conf
Traefik fail2ban
# /etc/fail2ban/filter.d/traefik-auth.conf
[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) .+\" 401 .+$
@wujku
wujku / data_collector.yaml
Created October 6, 2021 09:47
ESPHome example with ADC
esphome:
name: data-collector
platform: ESP32
board: esp-wrover-kit
# Enable logging
logger:
# Enable Home Assistant API
api:
@wujku
wujku / docker-compose.yml
Last active January 5, 2022 10:20
Simple local FTP by pure-ftpd
version: '3'
# Run after run container:
# Create user wujku which runs as the FTP system user. By default, the user will be chrooted to /home/ftpuser.
# $ docker exec -it pure-ftpd pure-pw useradd wujku -u ftpuser -d /home/ftpuser -m
# Update the database using the command
# $ docker exec -it pure-ftpd pure-pw mkdb
services:
ftpd_server:
@wujku
wujku / 4button_scene_switch_zha.yaml
Last active March 25, 2026 17:40
Blueprint for 4-Button Scene Switch (TS0044) – Home Assistant – Improved version of https://community.home-assistant.io/t/zha-tuya-4-button-scene-switch-ts0044/265099
blueprint:
name: ZHA - 4-Button Scene Switch
description: Automate your 4-Button Scene Switch via ZHA events.
domain: automation
input:
4button_scene_switch:
name: 4-Button Scene Switch
description: 4-Button Scene Switch to use
selector:
device:
binary_sensor:
- platform: template
sensors:
pc_relay_cwu_pump:
friendly_name: "Pompa CWU"
value_template: "{{ state_attr('sensor.heat_pump', 'relay_cwu_pump') }}"
device_class: power
pc_relay_co_pump:
friendly_name: "Pompa CO"
value_template: "{{ state_attr('sensor.heat_pump', 'relay_co_pump') }}"
var panel = new Ext.form.FormPanel({
title: 'Example',
width: 350,
items: [],
listeners: {
add: function(me, component, index) {
component.on('change', function(f,n,o) {
alert('detected! '+f.label+' value changed from '+o+' to '+n);
console.log(component.startValue);
});
@wujku
wujku / index.html
Created October 5, 2022 16:05
Smart home dashboard controller UI
<div class="dashboard">
<header>
<div class="f fe">
<div class="icon icon-w"></div>
<div class="heading">
<h5 class="date">1 Feb 2019</h5>
<h2 class="title">Cloudy</h2>
</div>
</div>
@wujku
wujku / daily_power_consumption
Last active November 1, 2022 18:24
InfluxDB – Power consumption
from(bucket: "home_assistant")
|> range(start: -30d)
|> filter(fn: (r) => r._measurement == "imp" and r._field == "value")
|> aggregateWindow(every: 1d, fn: spread, createEmpty: false)
|> map(fn: (r) => ({r with _value: r._value / 1000.0 }))
|> yield(name: "daily total")
@wujku
wujku / pimcore_previously_opened_tab_with_object.js
Last active November 24, 2022 08:45
Check if object from grid row was already opened as other tab
if (pimcore.globalmanager.exists("object_" + this.getStore().getAt(index).data.id)) {
// Your implementation
}
@wujku
wujku / add-gitlab-deploy-key-to-group-projects.sh
Last active November 28, 2023 10:06
Add a deploy key to projects from a specific group, taking into account that the API returns results with a limit of 100 elements per page
#!/bin/bash
# Zmienne
GITLAB_API="https://gitlab.com/api/v4" # Zmień na adres swojego GitLab
GROUP_ID="19" # Zmień na ID grupy, z której chcesz wyciągnąć projekty
DEPLOY_KEY_ID=$1 # Zmień na ID klucza deploy
# Print helpFunction in case parameters are empty
if [ -z "$DEPLOY_KEY_ID" ]
then