Skip to content

Instantly share code, notes, and snippets.

View supertunaman's full-sized avatar

Andrew "Tuna" Williamson supertunaman

View GitHub Profile
@supertunaman
supertunaman / fakeserver.sh
Last active December 12, 2015 04:08 — forked from pib/fakeserver.sh
#!/bin/bash
BODY="$1"
if [ -z "$1" ]; then
BODY="/proc/uptime"
fi
{
echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c $BODY | egrep -o '^[0-9]+')\r\nContent-Type: $(file -b --mime-type $BODY)\r\n\r\n"
cat $BODY
} | nc -l 8080 -v