Last active
November 6, 2018 07:08
-
-
Save pikatenor/cae4e5f0dab8fb2d8519e86e04c16630 to your computer and use it in GitHub Desktop.
sotsuron.app.p1kachu.net
This file contains 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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'sinatra' | |
index = <<-'EOS' | |
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>卒論</title> | |
<style> | |
body { | |
text-align: center; | |
background-color: #111; | |
color: crimson; | |
padding-top: 10%; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>卒論提出まであと <span id="countdown"></span></h1> | |
<h1>現在 <%= $count %> 字 / 12,000字</h1> | |
<script src="https://cdn.rawgit.com/moment/moment/2.20.1/min/moment.min.js" type="text/javascript"></script> | |
<script src="https://cdn.rawgit.com/mckamey/countdownjs/v2.6.0/countdown.min.js" type="text/javascript"></script> | |
<script src="https://cdn.rawgit.com/icambron/moment-countdown/0.0.3/dist/moment-countdown.min.js" type="text/javascript"></script> | |
<script> | |
var countdown = document.getElementById('countdown'); | |
var due = "2018-11-10 16:00"; | |
countdown.textContent = moment().countdown(due).toString(); | |
setInterval(function(){ | |
countdown.textContent = moment().countdown(due).toString(); | |
}, 1000); | |
</script> | |
</body> | |
</html> | |
EOS | |
$count = '0000' | |
token = ENV['TOKEN'] || 'poyo' | |
get '/' do | |
erb index | |
end | |
get '/:num' do | |
halt 403 unless request.env['HTTP_X_HIMITSUNO_TOKEN'] == token | |
$count = params[:num] | |
'ok' | |
end |
This file contains 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
FROM ruby:alpine | |
RUN gem install sinatra | |
COPY app.rb ./ | |
CMD ["ruby", "app.rb", "-o", "0.0.0.0"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This snippet has been licenced under WTFPL.
You just DO WHAT THE FUCK YOU WANT TO.