Using nftables for dynamic rules

Create ruleset File nftables.conf table inet mytable { set block_network { type ipv4_addr timeout 1h flags interval } set block_network6 { type ipv6_addr timeout 1h flags interval } chain input { type filter hook input priority 0; ip saddr @block_network drop ip6 saddr @block_network6 drop } } Load ruleset nft -f nftables.conf List ruleset nft list ruleset Add element nft add element ip my_filter block_network { 192.0.2.0/24; } nft add element ip6 my_filter block_network6 { 2001:db8::/32; } Delete element nft delete element ip my_filter block_network { 192.0.2.0/24; } nft delete element ip6 my_filter block_network6 { 2001:db8::/32; } Flush set nft flush ip my_filter block_network nft flush ip6 my_filter block_network6 Backup nft list ruleset > nftables.conf Restore nft restore < nftables.conf Delete Table nft delete table inet mytable Set nft delete set ip my_filter block_network nft delete set ip6 my_filter block_network6 Rule nft delete rule ip my_filter INPUT ip saddr @block_network drop nft delete rule ip6 my_filter INPUT ip6 saddr @block_network6 drop

ऑक्टोबर 9, 2025 · 1 min · 161 words · शंतनू

BOFH Excuses

HTTP Return codes 403 - Forbidden Permission denied – your clearance level is ‘intern’ but you’re asking for ‘god mode’ The server checked your credentials and laughed. Try again with bribes. You are not authorized to access this resource. Please try again after bribing the sysadmin. Your clearance level is too low. Please come back after a few promotions. The server is experiencing technical difficulties due to your lack of authorization. Access denied due to entropy imbalance in the user credential field. Your permissions were found in violation of the Heisenberg Uncertainty Principle. Permission denied — credentials failed the Turing Test. Server’s sarcasm buffer overflowed while reading your access level. You have exceeded the maximum number of attempts to access this resource. Please wait for the heat death of the universe before trying again. Our sysadmin has temporarily suspended your account due to an unexpected shortage of coffee. Wow, you’re really not supposed to be here. Please leave before we call security. It appears you’ve stumbled upon a page that’s still in beta testing. Or maybe it’s just a figment of your imagination. Either way, please try again later. Our servers are currently experiencing a shortage of witty banter. Please try again later when our supply has been replenished. Permission denied due to an unexpected outbreak of common sense. Please try again later when our servers have been restored to their usual state of chaos. You’ve exceeded the maximum amount of sass allowed per user. Please try again after a short period of time spent contemplating the meaning of sass. It seems our servers have been taken over by a group of rogue, sentient, coffee machines. Please try again later when they’ve finished brewing a fresh pot. You’ve reached a page that’s only accessible by solving a complex puzzle involving quantum superposition and interpretive tap dance. Sorry, buddy. Our system is currently down due to an unexpected shortage of existential dread. Please try again when the feeling of impending doom has been replenished. The server is experiencing technical difficulties due to an unexpected invasion of giant, mutant, radioactive philosophers. Please try again later when the philosophers have been relocated to a safe and secure location. You’ve exceeded the maximum amount of whimsy allowed per user. Please try again after a short period of time spent contemplating the meaning of whimsy. It seems our servers have been replaced with a never-ending loop of dad jokes. Please try again later when we’ve had a chance to debug the issue. Permission denied due to a temporary lapse in the rules of grammar. Please try again after the dictionary has been rebooted. You’ve reached a page that’s only accessible by navigating a treacherous maze of twisty little passages, all alike, while being serenaded by a choir of singing accountants. Sorry, buddy. Our system is currently down due to an unexpected outbreak of poetic license. Please try again later when our servers have been restored to their usual state of prose. The server is experiencing technical difficulties due to an unexpected invasion of giant, mutant, radioactive linguists. Please try again later when the linguists have been relocated to a safe and secure location. You’ve exceeded the maximum amount of nostalgia allowed per user. Please try again after a short period of time spent contemplating the meaning of nostalgia. It seems our servers have been taken over by a group of rogue, time-traveling, editors. Please try again later when they’ve finished proofreading our system’s documentation. Permission denied due to a rare condition known as “Sudden Onset Lack of Oxford Commas” (SOLC). Please try again after a few grammatical corrections. You’ve reached a page that’s only accessible by solving a complex puzzle involving semantic analysis and interpretive mime. Sorry, buddy. Our system is currently down due to an unexpected shortage of humor. Please try again when the laughter has been replenished. The server is experiencing technical difficulties due to an unexpected invasion of giant, mutant, radioactive comedians. Please try again later when the comedians have been relocated to a safe and secure location. You’ve exceeded the maximum amount of irony allowed per user. Please try again after a short period of time spent contemplating the meaning of irony. It seems our servers have been replaced with a never-ending loop of recursive self-referential paradoxes, written in a language that only exists in a parallel universe, where the skies are always purple and the grass is always green. Please try again later when we’ve had a chance to debug the issue. Permission denied due to a temporary lapse in the laws of thermodynamics. Please try again after the universe has been rebooted. You’ve reached a page that’s only accessible by navigating a treacherous maze of twisty little passages, all alike, while being attacked by a swarm of killer thesauruses. Sorry, buddy. The server is currently experiencing technical difficulties. Please try again later (or never).

जुलै 18, 2025 · 4 min · 815 words · शंतनू

Using ipset for dynamic rules

Create set IPv4 ipset create block_network hash:net family inet ipset create block_network hash:net timeout 3600 family inet IPv6 ipset create block_network6 hash:net family inet6 ipset create block_network6 hash:net timeout 3600 family inet6 Create firewall rules IPv4 iptables -I INPUT -m set --match-set block_network src -j DROP IPv6 ip6tables -I INPUT -m set --match-set block_network6 src -j DROP Block network IPv4 ipset add block_network 192.0.2.0/24 IPv6 ipset add block_network6 2001:db8::/32 Unblock network IPv4 ipset del block_network 192.0.2.0/24 IPv6 ipset del block_network6 2001:db8::/32 Flush set IPv4 ipset flush block_network IPv6 ipset flush block_network6 Delete set ipset destroy block_network ipset destroy block_network6 Backup ipset save block_network > block_network.ipset ipset save block_network6 > block_network6.ipset Restore ipset restore < block_network.ipset ipset restore < block_network6.ipset Delete firewall iptables -D INPUT -m set --match-set block_network src -j DROP ip6tables -D INPUT -m set --match-set block_network6 src -j DROP

जून 25, 2025 · 1 min · 141 words · शंतनू

Introduction to ZFS

Initialise Pool zpool create pool /dev/sdd /dev/sde The pool names mirror, raidz, draid, spare and log are reserved, as are names beginning with mirror, raidz, draid, and spare. Pool Size with Different Disk Sizes When creating a ZFS pool with disks of different sizes, the total usable size of the pool depends on the RAID configuration and the size of the smallest disk in the pool. ZFS aligns the storage capacity of all disks in a vdev to the smallest disk in that vdev. ...

मार्च 30, 2025 · 12 min · 2459 words · शंतनू

Get location of wallpaper in windows 11

Using powershell Option 1 Get-ItemPropertyValue 'Registry::HKEY_CURRENT_USER\Control Panel\Desktop' -Name WallPaper Option 2 $TIC=(Get-ItemProperty 'HKCU:\Control Panel\Desktop' TranscodedImageCache -ErrorAction Stop).TranscodedImageCache [System.Text.Encoding]::Unicode.GetString($TIC) -replace '(.+)([A-Z]:[0-9a-zA-Z\\])+','$2' SRC: https://www.thewindowsclub.com/how-to-find-the-current-desktop-background-image-in-windows

जुलै 29, 2024 · 1 min · 22 words · शंतनू

IPv6 on Docker Daemon

Create /etc/docker/daemon.json with following content. { "ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64" } Restart docker with systemctl restart docker. docker run \ -d -ti -p [IPV6-PUBLIC-IP]:PUBLICPORT:CONTAINERPORT --name test test_docker_image SRC: https://docs.docker.com/config/daemon/ipv6/

जुलै 6, 2024 · 1 min · 29 words · शंतनू

IPv6 on WSL2

Create .wslconfig in user home directory (%userprofile%) and add following. [wsl2] networkingMode=mirrored If file already exists, update it. Each network interface will be ethx $ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000 link/ether 00:00:00:00:00:01 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000 link/ether 00:00:00:00:00:02 brd ff:ff:ff:ff:ff:ff 4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:00:00:00:00:03 brd ff:ff:ff:ff:ff:ff inet 192.0.2.100/24 brd 192.0.2.255 scope global noprefixroute eth2 valid_lft forever preferred_lft forever inet6 2001:0DB8:0000:0000:0000:0000:0000:0000/128 scope global nodad noprefixroute valid_lft forever preferred_lft forever inet6 2001:0DB8:0001:0000:0000:0000:0000:0000/64 scope global nodad deprecated noprefixroute valid_lft forever preferred_lft 0sec inet6 fe80::0000:0000:0000:0000:0000/64 scope link nodad noprefixroute valid_lft forever preferred_lft forever 5: loopback0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff

डिसेंबर 29, 2023 · 1 min · 172 words · शंतनू

वात्रटिका

तो तिच्या वर चढला, म्हणून तुम्ही का हो त्याला नडला, शिडी त्याचीच, चढणारही तोच, तुम्हाला का हो लागली त्याची बोच ? त्याने तिची नाडी ओढली, तुम्हाला त्याची का हो पडली, चड्डी त्याचीच, ओढणार ही तोच, तुम्हाला का हो लागली त्याची बोच ? त्याने तिचे दोन्ही दाबले, तोंड तुमचे का हो आंबले, साईकल त्याची, ब्रेकही दाबणार तोच, तुम्हाला का हो लागली त्याची बोच ? त्याने तिला तेल लावून रगडली, तुमची तब्बेत का हो बिघडली, मानही त्याचीच, रगडणार ही तोच, तुम्हाला का हो लागली त्याची बोच ? त्याने तिला वाकवली, तुमची का हो उगाच सटकली, छड़ी ही त्याचीच, वाकवणारही तोच, तुम्हाला का हो लागली त्याची बोच ? त्याने तिला पेटवली, तुमची का हो जळली, सिगरेट त्याची, फुंकणार तोच, तुम्हाला का हो लागली त्याची बोच ? - मंगेश पाडगांवकर

मे 20, 2023 · 1 min · 126 words · शंतनू

Python Programming using Unicode

Code काहीनाही = None लिहा = print class सूर: def __init__(स्वतः, नाव): स्वतः.नाव = नाव स्वतः._वाहन = काहीनाही def माहिती(स्वतः): return {'नाव': स्वतः.नाव, 'वाहन': स्वतः.वाहन} @property def वाहन(स्वतः): return स्वतः._वाहन @वाहन.setter def वाहन(स्वतः, मूल्य): स्वतः._वाहन = मूल्य अनेक_सूर = [ सूर('पार्वती') सूर('गणपती'), सूर('शंकर'), सूर('कार्तिक') ] अनेक_सूर[0].वाहन = 'वाघ' अनेक_सूर[1].वाहन = 'मूषक' अनेक_सूर[2].वाहन = 'बैल' अनेक_सूर[3].वाहन = 'मोर' for एक_सूर in अनेक_सूर: लिहा(एक_सूर.नाव, '->', एक_सूर.वाहन) लिहा(एक_सूर.माहिती()) Output पार्वती -> वाघ {'नाव': 'पार्वती', 'वाहन': 'वाघ'} गणपती -> मूषक {'नाव': 'गणपती', 'वाहन': 'मूषक'} शंकर -> बैल {'नाव': 'शंकर', 'वाहन': 'बैल'} कार्तिक -> मोर {'नाव': 'कार्तिक', 'वाहन': 'मोर'}

जानेवारी 16, 2023 · 1 min · 94 words · शंतनू

Split Indic Words

Python Code import unicodedata def split_clusters(txt): """ Generate grapheme clusters for the Devanagari text.""" cluster = u'' end = False for char in txt: category = unicodedata.category(char) if (category == 'Lo' and end ) or category[0] == 'M': cluster = cluster + char else: if cluster: yield cluster cluster = char end = unicodedata.name(char).endswith(' SIGN VIRAMA') if cluster: yield cluster Go Code import ( "strings" "unicode" "golang.org/x/text/unicode/runenames" ) func splitClusters(txt string) (ret []string) { cluster := "" end := false for _, x := range txt { if (unicode.In(x, unicode.Lo) && end) || unicode.In(x, unicode.M, unicode.Mc, unicode.Me, unicode.Mn) { cluster += string(x) } else { if len(cluster) > 0 { if strings.TrimSpace(cluster) != "" { ret = append(ret, cluster) } } cluster = string(x) } end = strings.HasSuffix(runenames.Name(x), " SIGN VIRAMA") } if len(cluster) > 0 { if strings.TrimSpace(cluster) != "" { ret = append(ret, cluster) } } return }

जानेवारी 9, 2023 · 1 min · 150 words · शंतनू