Skip to content

Instantly share code, notes, and snippets.

@wujku
wujku / 4button_scene_switch_zha.yaml
Last active Mar 11, 2022
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
View 4button_scene_switch_zha.yaml
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:
@wujku
wujku / docker-compose.yml
Last active Jan 5, 2022
Simple local FTP by pure-ftpd
View docker-compose.yml
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 / data_collector.yaml
Created Oct 6, 2021
ESPHome example with ADC
View data_collector.yaml
esphome:
name: data-collector
platform: ESP32
board: esp-wrover-kit
# Enable logging
logger:
# Enable Home Assistant API
api:
View traefik-auth.conf
# /etc/fail2ban/filter.d/traefik-auth.conf
[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) .+\" 401 .+$
View greatest-n-per-group.sql
SELECT c.*, p1.*
FROM customer c
JOIN purchase p1 ON (c.id = p1.customer_id)
LEFT OUTER JOIN purchase p2 ON (c.id = p2.customer_id AND
(p1.date < p2.date OR p1.date = p2.date AND p1.id < p2.id))
WHERE p2.id IS NULL;
View nginx_magento_2_api_rewrite.conf
location /api {
rewrite ^/api/(.*) /rest/V1/custom_resource/$1 break;
proxy_pass $scheme://127.0.0.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@wujku
wujku / nginx_uri_map.conf
Created Apr 3, 2020
URI mapping with nginx
View nginx_uri_map.conf
# example.local/blog?query=code -> example.local/news?query=code
# example.local/blog/?query=code -> example.local/news?query=code
map $uri $new_uri {
/blog /news;
/test /demo;
}
server {
listen 80;
@wujku
wujku / nginx_cookie_restriction.conf
Created Apr 2, 2020
nginx authorization with cookie (Staging servers)
View nginx_cookie_restriction.conf
@wujku
wujku / Description.md
Created Feb 4, 2020 — forked from blakethepatton/Description.md
Getting Mailhog running on a dev server (nginx, letsencrypt, ssl, ubuntu)
View Description.md

Get it running as a service

wget https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64

mv MailHog_linux_amd64 mailhog

chmod +x mailhog

sudo vi /etc/systemd/system/mailhog.service