Skip to content

Instantly share code, notes, and snippets.

@nicolanrizzo
Last active December 10, 2016 15:18
Show Gist options
  • Save nicolanrizzo/055fcfb2ef3003c2ea6b0135c3608427 to your computer and use it in GitHub Desktop.
Save nicolanrizzo/055fcfb2ef3003c2ea6b0135c3608427 to your computer and use it in GitHub Desktop.
Setting up a one-shot webserver on port 8080 to present the content of a file. Source: https://en.wikipedia.org/wiki/Netcat
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <index.html)\r\n\r\n"; cat index.html; } | nc -l 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment