Last active
September 15, 2020 20:37
-
-
Save rainchen/3a91ef481e78ad38d51c91da0ab40e7f to your computer and use it in GitHub Desktop.
Revisions
-
rainchen revised this gist
Aug 31, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ require 'open3' server = WEBrick::HTTPServer.new :Port => 8000 server.mount_proc('/') { |req, res| res.body = Open3.capture2(ARGV[0], :stdin_data=>req.body)[0] } trap('INT') { server.shutdown } server.start # server: -
rainchen revised this gist
Aug 28, 2020 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,7 @@ require 'webrick' require 'open3' server = WEBrick::HTTPServer.new :Port => 8000 server.mount_proc('/') { |req, res| res.body = Open3.capture2(ARGV[0], :stdin_data=>req.body)[0] } trap 'INT' do server.shutdown end server.start -
rainchen revised this gist
Aug 28, 2020 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,7 @@ require 'open3' server = WEBrick::HTTPServer.new :Port => 8000 server.mount_proc '/' do |req, res| res.body = Open3.capture2(ARGV[0], :stdin_data=>req.body)[0] end trap 'INT' do server.shutdown end server.start @@ -12,4 +11,4 @@ # ruby webify-webrick.rb "wc -c" # client: # curl -d 'This is a really long sentence' http://localhost:8000 -
rainchen created this gist
Aug 28, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ require 'webrick' require 'open3' server = WEBrick::HTTPServer.new :Port => 8000 server.mount_proc '/' do |req, res| o, s = Open3.capture2(ARGV[0], :stdin_data=>req.body) res.body = o end trap 'INT' do server.shutdown end server.start # server: # ruby webify-webrick.rb "wc -c" # client: # curl -d 'This is a really long sentence' http://localhost:8000