Created
October 3, 2011 03:07
-
-
Save joshkehn/1258347 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SocketServer | |
import SimpleHTTPServer | |
PORT = 1339 | |
def fibonacci (n): | |
if n < 2: | |
return 1 | |
else: | |
return fibonacci(n - 2) + fibonacci(n - 1) | |
class CustomHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header('Content-Type', 'text/html') | |
self.end_headers() | |
self.wfile.write(fibonacci(40)) | |
return | |
httpd = SocketServer.ThreadingTCPServer(('localhost', PORT),CustomHandler) | |
print "serving at port", PORT | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment