Skip to content

Instantly share code, notes, and snippets.

@Markieta
Markieta / ddns-start
Last active October 30, 2022 23:16 — forked from ql-owo-lp/ddns-start
Asus-Merlin-DuckDNS
#!/bin/sh
# register a subdomain at https://www.duckdns.org/ to get your token
# put 'hostname:token' in the 'Host Name' field under DDNS
# e.g. myhost:abcdefgh-1234-5678-9876-f71b0ed7a7fe
DDNS_HOSTNAME_FIELD=$(nvram get ddns_hostname_x)
SUBDOMAIN=$(echo "$DDNS_HOSTNAME_FIELD" | awk -F':' '{print $1}')
TOKEN=$(echo "$DDNS_HOSTNAME_FIELD" | awk -F':' '{print $2}')
IPV4=$(nvram get wan0_ipaddr)
@Markieta
Markieta / google-ips.sh
Last active September 22, 2025 22:24
Dynamically update Google IP set for firewall4 (nftables) in OpenWrt.
#!/usr/bin/env ash
FILE4=/tmp/google-ipv4
FILE6=/tmp/google-ipv6
GOOG=$(curl -s https://www.gstatic.com/ipranges/goog.json)
IPV4=$(echo "$GOOG" | jq ".prefixes.[].ipv4Prefix | select( . != null )" -r)
IPV6=$(echo "$GOOG" | jq ".prefixes.[].ipv6Prefix | select( . != null )" -r)
reload=false
if ! diff $FILE4 <(echo "$IPV4") > /dev/null; then