This post is actually mainly a test for the google-syntax-highlighter WordPress plugin, but it also gives me a chance to share this small script.
EDIT: {This looks bland now, because I got rid of the aforementioned plugin. Looked great, but I don’t like that it’s all JavaScript (ends up showing the code unmodified for 2-3 seconds while the page loads). It needs to run when the page is generated server-side.}
Found a python one-liner a while back to serve the current directory, but needed the ability to specify what port to use (the one-liner used 8100). I added that, and came up with this. Just call it from any directory to serve the contents up in a quick-and-dirty HTTP server. It defaults to port 8100, or you can specify the port by doing servethis [PORT]
#!/usr/bin/python
import sys
import SimpleHTTPServer
import SocketServer
# minimal web server. serves files relative to the
# current directory.
PORT = 8100
if len(sys.argv) == 2:
PORT = int(sys.argv[1])
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()



That’s pretty cool.
Might come in handy. Thanks!
How ’bout this in Ruby:
#!/usr/bin/env ruby
require 'webrick'
include WEBrick
### It is possible to include specific file extensions, within the ""
s = HTTPServer.new(
trap("INT") { s.shutdown }
s.start
Obviously, I didn’t take the Port as an arg…with a script like this there doesn’t seem to be any advantage. Just edit the script.
James, where’s the Groovy version?
Well, as long as we’re doing simple versions, here’s the original one-liner I found. Just run it in your shell:
python -c “import SimpleHTTPServer;SimpleHTTPServer.test()”
hahahhahahaha you dropped chicken crumbs *snicker* *points and laughs*
How about this in Rudy?
^$/loser/gin/envelope prostitute
ortARTHUR => 666, :JimBobSonOf => Fish.glub(UR.pwoned,

acquire ‘yourmom’
disclude NETdick
AAA It is not probable to wear all hair extensions, outside the **
q = FTPTENNISBALL.old(
rap(“StopCollaborateListen”) { get.jiggywitit }
ice.baby