Skip to content

Instantly share code, notes, and snippets.

@MasterQ32
Created June 18, 2020 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasterQ32/19b7f15d9361dda1e3a6e611b0c97a77 to your computer and use it in GitHub Desktop.
Save MasterQ32/19b7f15d9361dda1e3a6e611b0c97a77 to your computer and use it in GitHub Desktop.
Mini Gemini Server
#!/bin/bash
encodings="UTF-8 UTF-16LE UTF-16BE UTF-32LE UTF-32BE WINDOWS-1252 TCVN-5712 CP437 EBCDICATDE"
for enc in ${encodings,,}; do
echo -ne "20 text/plain charset=${enc}\r\n" > ${enc,,}.txt
echo -e "Serving content as ${enc}\n" | iconv -f "UTF-8" -t "${enc}" >> ${enc,,}.txt
iconv -f "UTF-8" -t "${enc}//TRANSLIT" ground-truth.txt >> ${enc,,}.txt
done
#!/bin/bash
echo "listening..."
for f in "$@"; do
cat "$f" | ncat --ssl --ssl-cert ../cert.pem --ssl-key ../key.pem --listen 1965
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment