Skip to content

Instantly share code, notes, and snippets.

View TheDcoder's full-sized avatar

TheDcoder TheDcoder

View GitHub Profile
#!/usr/bin/fish
# NetworkManager-dispatcher script to disable IPv6 for WireGuard VPN connections
#
# The `vpn-{up,down}` events are not sent for WG connections, so we have to use
# pattern matching on the interface on generic `up/down` events, by default this
# script matches any interface which starts with `wg`.
#
# Just install this script in `/etc/NetworkManager/dispatcher.d` to use it.
# (Don't forget to install fish shell since this is a fish script, not bash)
@TheDcoder
TheDcoder / README.md
Created December 8, 2025 18:13
Only allow Cloudflare IPs to connect to port 443 (HTTPS) - Created by Gemini 3 Pro

Block non-Cloudflare IPs from accessing HTTPS

  1. Copy .sh script to /usr/local/bin and chmod +x it
  2. Copy the .service and .timer files to /etc/systemd/system
  3. systemctl enable --now cloudflare-nft.{service,timer}
@TheDcoder
TheDcoder / gist:0c5acf8599f5ed70544ca27a3c35de95
Created November 16, 2024 12:40
Find your lost horse (or any entity with custom NBT filters) in Minecraft with this command
/execute at @e[nbt={Tame:1b}] run tp @p ~ ~ ~
@TheDcoder
TheDcoder / gog-consent.user.js
Last active December 14, 2024 01:05
GOG Don't Giveaway Consent - Revoke consent for sharing data with third-parties when claiming a giveaway
@TheDcoder
TheDcoder / debug.sh
Created August 14, 2023 23:11
Ultimate Debugging for Bash
# Start bash with `-x` option with this env var
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
@TheDcoder
TheDcoder / symlink-uutils
Created June 6, 2023 07:48
Script to symlink uutils (coreutils made in Rust) into /usr/local/bin so that they are used over GNU coreutils
@TheDcoder
TheDcoder / file-subset-example.sh
Created June 30, 2022 12:18
Check if file A is a subset of file B (file B contains contents of file A)
# Example perl script to check if file A is a subset of file B (i.e. file A has any part of file B)
perl -Mautodie=open -e 'undef $/; open $f1, "<", shift; open $f2, "<", shift; exit !!(-1 == index <$f2>, <$f1>)' -- fileA fileB
# Credit: tirnanog on Libera.Chat
@TheDcoder
TheDcoder / gog-abolish-rep.user.js
Created May 17, 2022 07:27
GOG Abolish Reputation System
// ==UserScript==
// @name GOG Abolish Reputation System
// @author [email protected]
// @description Abolish GOG forum's reputation system
// @version 1.0
// @namespace Violentmonkey Scripts
// @match http*://www.gog.com/forum/*/*
// @grant GM_addStyle
// @grant GM_registerMenuCommand
// @grant GM_getValue
@TheDcoder
TheDcoder / lenof.h
Created October 18, 2020 13:26
lenof - C macro function to retrieve lenght (size) an array
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@TheDcoder
TheDcoder / syncthing_portable.py
Created August 29, 2020 11:29
Portable syncthing helper tool to create portable and isolated instances
#!/usr/bin/env python3
import os
import xml.etree.ElementTree as ET
HOME_DIR_NAME = '.syncport'
CMD_PARAMS = ['-no-restart']
def main():
print("Setting up portable syncthing...")