Python > Ruby
This commit is contained in:
parent
fbe364d506
commit
6b2a2119e9
|
@ -1,4 +1,26 @@
|
|||
[[Category:Ruby]]
|
||||
[[Category:Ruby]] [[Category:Python]]
|
||||
|
||||
=Python=
|
||||
|
||||
<source lang="python">
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.web import server, static
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print "Usage: %s <port> <dir>" % (sys.argv[0],)
|
||||
sys.exit()
|
||||
|
||||
root = static.File(sys.argv[2])
|
||||
site = server.Site(root)
|
||||
|
||||
reactor.listenTCP(int(sys.argv[1]), site)
|
||||
reactor.run()
|
||||
</source>
|
||||
|
||||
=Ruby=
|
||||
|
||||
<source lang="ruby">
|
||||
#!/usr/local/bin/ruby
|
||||
|
|
Loading…
Reference in New Issue