Last active
December 7, 2020 16:31
-
-
Save antonsoroko/974924e0692aa2171229dafa5f2561b2 to your computer and use it in GitHub Desktop.
ardo_app
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
| require 'rubygems' | |
| require 'sinatra' | |
| # Unique identifier for the app's lifecycle. | |
| # Useful for checking that an app doesn't die and come back up. | |
| ID = SecureRandom.uuid | |
| $stdout.sync = true | |
| $stderr.sync = true | |
| get '/' do | |
| "Hello from #{ID}!" | |
| end | |
| get '/env' do | |
| ENV.inspect | |
| end | |
| get '/sigterm' do | |
| "Available sigterms #{`man -k signal | grep list`}" | |
| end | |
| get '/sigterm/:signal' do | |
| pid = Process.pid | |
| signal = params[:signal] | |
| puts "Killing process #{pid} with signal #{signal}" | |
| Process.kill(signal, pid) | |
| end | |
| get '/log/:bytes' do | |
| system "cat /dev/zero | head -c #{params[:bytes].to_i}" | |
| "Just wrote #{params[:bytes]} bytes of zeros to the log" | |
| end |
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
| require "./app" | |
| run Sinatra::Application |
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
| source "http://rubygems.org" | |
| gem "sinatra" |
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
| GEM | |
| remote: http://rubygems.org/ | |
| specs: | |
| rack (1.5.1) | |
| rack-protection (1.3.2) | |
| rack | |
| sinatra (1.3.4) | |
| rack (~> 1.4) | |
| rack-protection (~> 1.3) | |
| tilt (~> 1.3, >= 1.3.3) | |
| tilt (1.3.3) | |
| PLATFORMS | |
| ruby | |
| DEPENDENCIES | |
| sinatra |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment