-
-
Save m040601/625986 to your computer and use it in GitHub Desktop.
post file - mecha/yam/ENV
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
= A submission script for AizuOnlineJudge(AOJ; http://rose.u-aizu.ac.jp/onlinejudge/index.jsp ). | |
== Requirement | |
- Ruby1.9.x | |
- Mechanize (execute '$ gem install mechanize' if you don't have it) | |
== How to use. | |
1. Edit submit.auth.yaml with your AOJ id and Password. | |
2. Place your answer program XXXX.c in the same directory (XXXX is the problem id). | |
3. $ ruby submit.rb XXXX | |
4. See the Status page (http://rose.u-aizu.ac.jp/onlinejudge/Status.jsp ) with your browser, submission will be listed on it. | |
== ATTENTION | |
This script is unofficial. NO WARRANTY. Use it at your own risk. | |
== License | |
Author: Biangle <[email protected]> | |
License: MIT |
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
userID: YourUserid | |
password: YourPassword |
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 'yaml' | |
require 'logger' | |
require 'mechanize' | |
AOJ_SUBMIT_URL='http://rose.u-aizu.ac.jp/onlinejudge/servlet/Submit'.freeze | |
YAML_PATH = File.join(File.dirname(File.expand_path(__FILE__)), | |
'submit.auth.yaml').freeze | |
if 1 != ARGV.size | |
warn "usage: ruby #{__FILE__} 0001" | |
exit 1 | |
end | |
auth = YAML.load_file(YAML_PATH) | |
Mechanize.new do |agent| | |
agent.log = Logger.new(STDOUT) | |
query = auth.clone | |
query['problemNO'] = ARGV[0] | |
query['language'] = 'C' | |
query['sourceCode'] = File.binread("#{ARGV[0]}.c").chomp | |
agent.post(AOJ_SUBMIT_URL, query) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment