Skip to content

Instantly share code, notes, and snippets.

@nebuxadnezzar
nebuxadnezzar / udp-listener-with-interrupt-chan.go
Created December 8, 2023 20:49
UDP listener and more... Demonstrates UDP echo server, generics, flag command line argument usage, range parsing.
package main
// go run udp-listener-with-interrupt-chan.go -p 8008:8009
// echo hello kosmos | nc -u -v -w 1 0.0.0.0 8009
import (
"fmt"
"net"
"os"
"os/signal"
@nebuxadnezzar
nebuxadnezzar / index.cgi
Last active April 25, 2024 20:25
directory listing script used for busybox httpd server
#!/bin/bash +x
folder=${REQUEST_URI#${SCRIPT_NAME}}
echo "Content-Type: text/html; charset=UTF-8"
echo "Connection: close"
echo ""
cat <<EOF
<!doctype html>
<html lang="en-US">
<head>
@nebuxadnezzar
nebuxadnezzar / printenv.cgi
Last active April 24, 2024 16:12
a cgi script for busybox httpd to print environment vars, could be useful for debugging, protect its access with password
#!/bin/sh
printf "Content-Type: text/html\r\n"
printf "\r\n"
echo "Environment variables:"
echo "<pre>"
env | sort
echo "</pre>"