To disable it, just put this in your .bachrc:
complete -r
awk '{s+=$1} END {print s}'
su - therebemonstershere -c " { /usr/local/bin/mydaemon & } "
su - therebemonstershere -c " { /usr/local/bin/mydaemon & } ; echo \$! > /var/run/mydaemon.pid"
su - therebemonstershere -c " { /usr/local/bin/mydaemon > /var/log/mydaemon.log 2>&1 & } ; echo \$! > /var/run/mydaemon.pid"
su - therebemonstershere -c " { nohup /usr/local/bin/mydaemon > /var/log/mydaemon.log 2>&1 & } ; echo \$! > /var/run/mydaemon.pid"
import BaseHTTPServer
from SocketServer import ForkingMixIn
import socket
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
path = self.path
msg = ...
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(msg)
self.wfile.close()
self.connection.shutdown(socket.SHUT_RDWR)
self.connection.close()
long_computation()
class ForkingHTTPServer(ForkingMixIn, BaseHTTPServer.HTTPServer):
"""
Handle requests in a separate process.
"""
pass
server = ForkingHTTPServer((host,port), handler_factory(override))
server.serve_forever()The key is this bit:
self.connection.shutdown(socket.SHUT_RDWR) self.connection.close()
int accumulator = 0;
while( b = file.readByte() ) {
accumulator = accumulator | b;
accumulator = accumulator << 8;
}
int accumulator = 0;
while( b = file.readByte() ) {
short s = (short) b;
if( s < 0 ) {
s = s + 0x100;
}
accumulator = accumulator | s;
accumulator = accumulator << 8;
}
s = struct.unpack("B", file.read(1))