Skip to content

Instantly share code, notes, and snippets.

@adrianmihalko
adrianmihalko / gist:abd30eb6f3dd458d81b73c80885b52ae
Created Jan 21, 2022
Fix empty tvg-name for IPTV playlist
View gist:abd30eb6f3dd458d81b73c80885b52ae
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
@adrianmihalko
adrianmihalko / gist:336d422bf8ec0852c9947b4b8437fa22
Created Dec 12, 2021
"None of the ports were configured to use SSL certificate" - Dymo Web Service
View gist:336d422bf8ec0852c9947b4b8437fa22
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 / routing.txt
Created Nov 25, 2021
Destination based routing on Unifi USG and Edgerouter
View routing.txt
@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
View gist:f2082454232c92d1905c01c310c28c64
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
View config.gateway.json2
{
"firewall": {
"modify": {
"LOAD_BALANCE": {
"description": "LOAD_BALANCE",
"rule": {
"2501": {
"action": "modify",
"modify": {
"table": "5"
@adrianmihalko
adrianmihalko / gist:62ed2ea8dc1f75780d3bf5d2a292cc86
Created Feb 26, 2021
One line webserver with request logging with python twisted
View gist:62ed2ea8dc1f75780d3bf5d2a292cc86
python -c 'from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; from twisted.python import log; import sys; log.startLogging(sys.stdout); reactor.listenTCP(1990, Site(File("."))); reactor.run()'
@adrianmihalko
adrianmihalko / agistfile1.txt
Last active Feb 21, 2021
Selective routing trough VPN with Unifi USG.
View agistfile1.txt
I wanted to route only specific IPs trough a Wireguard interface. I am not expert in any way, but I am trying to explain you as best I can how I did it.
Setup a WG connection as usual on one of your device in your network (In my example I will call it "Ubuntu server", 192.168.1.54):
[Interface]
Address = something/24
PrivateKey = longprivatekeyR5FE=
Table = 43
PostUp = ip rule add from 192.168.1.91 table 43; iptables -w -A FORWARD -i %i -j ACCEPT; iptables -w -A FORWARD -o %i -j ACCEPT; iptables -w -t nat -A POSTROUTING -o ens160 -j MASQUERADE; iptables -t nat -A POSTROUTING -o %i -j MASQUERADE
@adrianmihalko
adrianmihalko / networkmap1.png
Last active Mar 29, 2020
wireguard edgerouter mullvad config
View networkmap1.png
!!!NOT WORKING!!!
configure
set interfaces wireguard wg0 address 10.xx.xxx.253/32
set interfaces wireguard wg0 listen-port 51820
set interfaces wireguard wg0 route-allowed-ips false
set interfaces wireguard wg0 peer JuE+ endpoint mullvadserverip:51820
set interfaces wireguard wg0 peer JuE+ allowed-ips 0.0.0.0/0
@adrianmihalko
adrianmihalko / gist:cfc076b28a3ff4652766a295972a9945
Created Feb 6, 2019
Convert all white transparent icons into transparent black (change icon color)
View gist:cfc076b28a3ff4652766a295972a9945
for f in *.png ; do convert "$f" -fill black -colorize 100 "${f%.png}.png" ; done
@adrianmihalko
adrianmihalko / sonoff.yaml
Last active Jan 28, 2019
Sonoff, Esphome
View sonoff.yaml
esphomeyaml:
name: sonoff_1
platform: ESP8266
board: esp01_1m
wifi:
ssid: ''
password: ''
manual_ip: