Skip to content

Instantly share code, notes, and snippets.

View duxsco's full-sized avatar

David Sardari duxsco

View GitHub Profile
@duxsco
duxsco / openresolv.patch
Last active August 7, 2024 07:13
openresolv patch setting up DNS-over-TLS if not connected over VPN
diff --git a/hooks/20-resolv.conf b/hooks/20-resolv.conf
index 7c29e27..d65892a 100644
--- a/hooks/20-resolv.conf
+++ b/hooks/20-resolv.conf
@@ -170,9 +170,36 @@ add_resolv_conf()
for x in ${new_domain_name_servers}; do
conf="${conf}nameserver $x$NL"
done
+
if $have_resolvconf; then
@duxsco
duxsco / gist:3887ebe1c826a46f70a92e48765db16d
Last active July 28, 2024 13:04
Gentoo distfile mirrors with support for TLSv1.3 and QUIC protocol
bash-5.2$ curl -fs --proto '=https' --tlsv1.3 https://api.gentoo.org/mirrors/distfiles.xml | xq -r '.mirrors.mirrorgroup[].mirror | if type=="array" then .[] else . end | .uri | if type=="array" then .[] else . end | select(."@protocol" == "https") | ."#text"' | sed 's#\([^/]$\)#\1/#' | while read -r url; do curl -s -o /dev/null -w "%{http_code} %{url}\n" --proto '=https' --tlsv1.3 --http3-only -I "$url"; done | sort
000 https://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/
000 https://ftp.agdsn.de/gentoo/
000 https://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/
000 https://ftp.fau.de/gentoo/
000 https://ftp.gwdg.de/pub/linux/gentoo/
000 https://ftp.halifax.rwth-aachen.de/gentoo/
000 https://ftp.heanet.ie/mirrors/gentoo.org/
000 https://ftp.jaist.ac.jp/pub/Linux/Gentoo/
000 https://ftp.kaist.ac.kr/pub/gentoo/
@duxsco
duxsco / openpgp.md
Created February 28, 2023 18:37
Proof for Keyoxide

$argon2id$v=19$m=64,t=512,p=2$5B3kDsGCaT0E44cHh0d6kw$Mny+1YkYA404V8CLuTd/vQ

@duxsco
duxsco / unset.md
Last active May 8, 2022 23:50
Prevent "tainting" Bash script variables via environment

I decided to use following convention for variables in my Bash scripts:

A) Variables are written without curly brackets if:

  • They are fine to be set via environment, e.g. $HOME
  • The environment doesn't play a role, e.g. $OPTARG whose value is set by getopts

B) All other variables are written with curly brackets, e.g.: ${KERNEL_VERSION}

Variables that fall under scenario B) are unset at the beginning of the Bash script.