DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

One-line Web Server In Ruby

  • submit to reddit

# From:
# Author: Michael Neumann
# ... point your browser to http://localhost:3125/etc/motd

ruby -rsocket -e '**5);loop{_=s.accept;_<<"HTTP/1.0 200 OK\r\n\r\n#{[1])rescue nil}";_.close}'