commit 17ac2e11ac5dfb4d2dc2180c868a7f61bf01a32e
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Thu, 21 Nov 2019 16:44:14 -0500
Initial commit
Diffstat:
| A | server.rb |  |  | 148 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
1 file changed, 148 insertions(+), 0 deletions(-)
diff --git a/server.rb b/server.rb
@@ -0,0 +1,148 @@
+require 'socket'
+require 'time'
+
+confucius = [
+  "it take square ass to shit a brick.",
+  "woman who cooks beans and peas in same pot very unsanitary.",
+  "man who fart in church sit in own pew.",
+  "baseball very funny game - man with 4 balls no can walk!",
+  "woman who dance while wearing jock strap have make believe ballroom.",
+  "man who fly plane upside down have crackup.",
+  "man with hole in pocket feel cocky all day.",
+  "woman who ride bicycle in city pedal ass all over town.",
+  "secretary not permanent, till screwed on desk.",
+  "a girl's best asset is her 'lie'ability.",
+  "support bacteria -- it's the only culture some people have!",
+  "man who run behind car get exhausted.",
+  "man who eat jellybean fart in technicolor.",
+  "man who go to bed with itchy butt wake with smelly finger.",
+  "baby conceived on back seat of car with automatic transmission, grow up to be shiftless bastard.",
+  "man who lay girl on hill not on level.",
+  "boy who go to bed with sex problem wake up with solution in hand.",
+  "kotex not best thing on earth, but next to best thing.",
+  "man who marries a girl with no bust has right to feel low down.",
+  "man with atletic finger make broad jump.",
+  "squirrel who runs up woman's leg not find nuts.",
+  "he who fishes in another man's well often catches crab.",
+  "man who speaks with forked tongue should not kiss baloons.",
+  "man who lose key to apartment not get new key.",
+  "he who sitteth on an upturned tack shall surely rise.",
+  "even the greatest of whales is helpless in middle of desert.",
+  "the hand that turneth the knob, opens the door.",
+  "boy with hole in pocket, feel cocky all day.",
+  "man who argue with wife all day get no peace at night.",
+  "man who lay woman on ground have peace (piece) on earth.",
+  "man who sneezes without hanky takes matters into his own hands..",
+  "man who run behind car get exhausted.",
+  "man who is jacking into a peanut butter jar is fucking nuts.",
+  "wash your face in the morning, neck at night.",
+  "man who stand on toilet get high on pot.",
+  "man who fly upside-down have crack up!",
+  "he who eats to many prunes, sits on toilet many moons.",
+  "man who walk through airport door sideways is going to Bangkok.",
+  "man who drop watch in toilet bound to have shitty time.",
+  "woman who cooks beans and peas in same pot very unsanitary.",
+  "man who fart in church sit in own pew.",
+  "baseball very funny game--man with 4 balls no can walk!!",
+  "woman who dance while wearing jock strap have make believe ballroom.",
+  "man who fly plane upside down have crackup.",
+  "when lady say no, she mean maybe; when lady say maybe, she mean yes; when lady say yes, she no lady.",
+  "man with hole in pocket feel cocky all day.",
+  "woman who ride bicycle in city pedal ass all over town.",
+  "a girl's best asset is her 'lie'ability.",
+  "man who run behind car get exhausted.",
+  "man who eat jellybean fart in technicolor.",
+  "man who go to bed with itchy butt wake with smelly finger.",
+  "man who lay girl on hill not on level.",
+  "boy who go to bed with sex problem wake up with solution in hand.",
+  "kotex not best thing on earth, but next to best thing.",
+  "man who marries a girl with no bust has right to fell low down.",
+  "man with atletic finger make broad jump.",
+  "squirrel who runs up woman's leg not find nuts.",
+  "he who fishes in another man's well often catches crab.",
+  "man who go to bed with sex on mind, wakes with solution in hand.",
+  "he who fishes in another man's well often catches crab.",
+  "he who outruns the cheetah is fucking fast on his feet!",
+  "there is no such thing as rape; Woman run faster with skirt up, than Man with pants down.",
+  "man who take lady on camping trip have one intent.",
+  "man who put head on railroad track get splitting headache.",
+  "he who pull out to fast leave rubber behind.",
+  "he who refuses to listen is lying.",
+  "he who stands in corner with hands in pocket doesn't feel crazy, feels nuts.",
+  "he who eats to many prunes, sits on toilet many moons.",
+  "man who walk through airport door sideways is going to Bangkok.",
+  "America Good Place to Put Chinese restaurant.",
+  "man who drop watch in toilet bound to have shitty time.",
+  "woman who cooks beans and peas in same pot very unsanitary.",
+  "man who fart in church sit in own pew.",
+  "baseball very funny game--man with 4 balls no can walk!!",
+  "woman who dance while wearing jock strap have make believe ballroom.",
+  "man who fly plane upside down have crackup.",
+  "man with hole in pocket feel cocky all day.",
+  "woman who ride bicycle in city pedal ass all over town.",
+  "a girl's best asset is her 'lie'ability.",
+  "man who run behind car get exhausted.",
+  "man who eat jellybean fart in technicolor.",
+  "man who go to bed with itchy butt wake with smelly finger.",
+  "baby conceived on back seat of car with automatic transmission grow up to be shiftless bastard.",
+  "man who lay girl on hill not on level.",
+  "boy who go to bed with sex problem wake up with solution in hand.",
+  "kotex not best thing on earth, but next to best thing.",
+  "man who marries a girl with no bust has right to fell low down.",
+  "man with atletic finger make broad jump.",
+  "squirrel who runs up woman's leg not find nuts.",
+  "he who fishes in another man's well often catches crab.",
+  "he who fishes in another man's well often catches crab.",
+  "he who outruns the cheetah is fucking fast on his feet!",
+  "man who take lady on camping trip have one intent.",
+  "man who put head on railroad track get splitting headache.",
+  "he who pull out to fast leave rubber behind.",
+  "he who refuses to listen is lying.",
+  "he who stands in corner with hands in pocket doesn't feel crazy, feels nuts.",
+  "he who eats to many prunes, sits on toilet many moons.",
+  "man who have woman on ground have piece on earth.",
+  "woman who fly upside down have hairy crackup.",
+  "man who take lady on camping trip have one intent.",
+  "man who walk through airport door sideways is going to Bangkok.",
+  "man who drop watch in toilet bound to have shitty time.",
+  "man who is jacking into a peanut butter jar is fucking nuts.",
+  "he who pull out to fast leave rubber behind.",
+  "man with hands in pockets feel foolish, Man with hole in pocket feel nuts.",
+  "man who lay woman on ground have peace (piece) on earth.",
+  "man who sneezes without hanky takes matters into his own hands.",
+  "secretary not permanent, till screwed on desk.",
+  "it take square ass to shit a brick.",
+  "woman who not practise sex before marriage is sentenced to an indeterminate length.",
+  "he who sniffs Coke, drowns.",
+  "crowded elevator smells different to midget.",
+  "lady who live in glass house, dress in basement!",
+  "to make egg roll, push it.",
+  "Woman who puts detergent on top shelf, Jump for Joy.",
+  "man who screws near graveyard is fucking near dead.",
+  "man who lay girl on hill, not on level.",
+  "man who fishes in other man's well often catch crabs.",
+  "boy who play with himself pulls boner.",
+  "woman who cooks carrots and pees in same pot very unsanitary.",
+  "man who marry girl with no bust has right to feel low down.",
+  "man who sleeps with old hen finds it's better than pullet.",
+  "man with hole in pocket feel cocky all day."
+]
+
+server = TCPServer.new('0.0.0.0', 80)
+
+loop do
+  Thread.start (server.accept) do |socket|
+    request = socket.gets
+    STDERR.puts request
+
+    response = "Confucius say, #{confucius.sample}\n"
+    socket.print "HTTP/1.1 200 OK\r\n" +
+      "Content-Type: text/plain\r\n" +
+      "Content-Length: #{response.bytesize}\r\n" +
+      "Connection: close\r\n"
+      socket.print "\r\n"
+
+      socket.print response
+      socket.close
+  end
+end