Skip to content

Instantly share code, notes, and snippets.

@adrianmihalko
adrianmihalko / gist:f2082454232c92d1905c01c310c28c64
Created November 25, 2021 14:45
Policy based routing on USG
policy-based routing on USG.
NOTES & REQUIREMENTS:
Applicable to all UniFi Security Gateway models (USG / USG-PRO-4 / USG-XG-8).
This article does not apply to the UniFi Dream Machine (UDM) models.
This article contains advanced JSON configurations using the CLI and should only be attempted by advanced users.
See the Configuration Using config.gateway.json help center article for more information on JSON configurations.
Introduction
@adrianmihalko
adrianmihalko / routing.txt
Created November 25, 2021 19:40
Destination based routing on Unifi USG and Edgerouter
@UniFiSecurityGateway3P:/config$ configure
@UniFiSecurityGateway3P# set protocols static table 5 interface-route 0.0.0.0/0 next-hop-interface wg0
@UniFiSecurityGateway3P# set firewall modify VPN_Gateway rule 2502 action modify
@UniFiSecurityGateway3P# set firewall modify VPN_Gateway rule 2502 modify table 5
@UniFiSecurityGateway3P# set firewall modify VPN_Gateway rule 2502 destination group address-group 6029c3e9e4f9411eca96870f
@UniFiSecurityGateway3P# set firewall modify VPN_Gateway rule 2502 protocol all
@UniFiSecurityGateway3P# set interfaces ethernet eth1 firewall in modify VPN_Gateway
@UniFiSecurityGateway3P# commit
@adrianmihalko
adrianmihalko / gist:336d422bf8ec0852c9947b4b8437fa22
Created December 12, 2021 19:14
"None of the ports were configured to use SSL certificate" - Dymo Web Service
I can't describe how much I hate Dymo developers. Long hours of annoyance were caused by their negligence.
So you are here, because you are looking for solution for "None of the ports were configured to use SSL certificate"
- when you try to diagnose Dymo Web Service.
The good developers at Dymo forgot to delete/check/reinstall (call as you want) certificates when you uninstall/reinstall the web service.
After hours (days!) I found the solution.
@adrianmihalko
adrianmihalko / gist:abd30eb6f3dd458d81b73c80885b52ae
Created January 21, 2022 19:06
Fix empty tvg-name for IPTV playlist
If for some reason you got an IPTV playlist which has empty tvg-name, but actual channel names are exists at the end of line, example:
#EXTINF:-1 tvg-id="none" tvg-name="none" tvg-logo="" group-title="Testing", Test_Title_CC (GER)
#EXTINF:-1 tvg-id="none" tvg-name="none" tvg-logo="" group-title="Testing", Cup Mus (GER)
#EXTINF:-1 tvg-id="none" tvg-name="New World (NED)" tvg-logo="" group-title="Apple", New World (NED)
you can use awk to fix this issue:
awk 'BEGIN{FS=", "}/^#EXTINF:-1/&&/tvg-name="none"/{sub(/tvg-name="none"/,"tvg-name=\x22" $NF "\x22")}{print}' file.txt
# Basic sensor, read everything from MQTT
- platform: mqtt
name: "WLANThermo"
# change topic to your modelname!
state_topic: "WLanThermo/NANOv3/status/data"
value_template: "{{ value_json.system.soc }}"
# change topic to your modelname!
json_attributes_topic: "WLanThermo/NANOv3/status/data"
json_attributes_template: "{{ value_json | tojson }}"
device_class: battery