Last active
January 16, 2017 04:30
-
-
Save jhonber/7c339982f550b07398cbbdaffcc60d18 to your computer and use it in GitHub Desktop.
Revisions
-
jhonber revised this gist
Jan 16, 2017 . 1 changed file with 7 additions and 6 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 @@ -17,7 +17,7 @@ // Note: The delay in get_url() is necessary because URI blocks many requests // per second // // (If you just want to do a little test, you can set the variable 'pages' equal to 1, // for download only 1 page) function downloadURI (uri) { @@ -35,9 +35,10 @@ function get_url (id, tab, cb) { newTab.onload = function () { var ans = newTab.document.getElementsByClassName('dropbox-saver')[0].href; tab.opener.downloadURI(ans); setTimeout(function() { newTab.close(); cb(null) }, 1000 ); }; @@ -75,11 +76,11 @@ function fetch_page (page, cb) { } function go (i) { if (i == pages) { return; } else { fetch_page(i, function (err) { if (!err) { setTimeout( function () { @@ -94,4 +95,4 @@ function go (i) { } var pages = parseInt(document.getElementById('table-info').innerText.split(' ')[2]); go (1) -
jhonber revised this gist
Jan 16, 2017 . 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 @@ -17,7 +17,7 @@ // Note: The delay in get_url() is necessary because URI blocks many requests // per second // // (If you just want to do a little test, you can set the variable 'pages' equal to 0, // for download only 1 page) function downloadURI (uri) { -
jhonber revised this gist
Jan 15, 2017 . 1 changed file with 1 addition and 0 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 @@ -10,6 +10,7 @@ // Otherwise you will need to do click in download popup for every submission // // 4) Open the browser console and excecute this code // 5) After download, if you want to rename the files see 'rename.js' // // * The download rate is approximately 1 submission every 2 seconds // -
jhonber revised this gist
Jan 15, 2017 . 1 changed file with 23 additions and 0 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 @@ -0,0 +1,23 @@ // Rename file like 'UOJ_2235 - (5859660) Accepted.cpp' to '2235.cpp' var fs = require('fs'), exec = require('child_process').exec; fs.readdir('./', function (err, files) { if (err) console.log(err); else { for (var i = 0; i < files.length; ++i) { var cur = files[i]; var id = cur.split(' ')[0].split('_')[1]; var ext = cur.split('.')[1] var name = id + '.' + ext; if (id) { var cmd = 'mv "' + cur + '" ' + name; exec(cmd, function (err, stdout, stderr) { if (err) console.log(err); }); } } } }); -
jhonber revised this gist
Jan 15, 2017 . 1 changed file with 0 additions 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 @@ -73,7 +73,6 @@ function fetch_page (page, cb) { } function go (i) { if (i > pages) { return; -
jhonber revised this gist
Jan 15, 2017 . 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 @@ -19,9 +19,8 @@ // (If you just want to do a little test, you can set the variable 'pages' equal to 1, // for download only 1 page) function downloadURI (uri) { var link = document.createElement('a'); link.href = uri; document.body.appendChild(link); link.click(); @@ -34,7 +33,7 @@ function get_url (id, tab, cb) { newTab.onload = function () { var ans = newTab.document.getElementsByClassName('dropbox-saver')[0].href; tab.opener.downloadURI(ans); newTab.close(); setTimeout(function() { cb(null)}, -
jhonber created this gist
Jan 15, 2017 .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,98 @@ // Get your Accepted submissions from URI www.urionlinejudge.com.br, the submissions // are stored in downloads directory // // (** Required latest version of Firefox / Google chrome) // // Instructions: // 1) Login www.urionlinejudge.com.br // 2) Go to https://www.urionlinejudge.com.br/judge/en/runs?answer_id=1 // 3) (** Important **) Configure automatic download in your browser (without ask) // Otherwise you will need to do click in download popup for every submission // // 4) Open the browser console and excecute this code // // * The download rate is approximately 1 submission every 2 seconds // // Note: The delay in get_url() is necessary because URI blocks many requests // per second // // (If you just want to do a little test, you can set the variable 'pages' equal to 1, // for download only 1 page) function downloadURI (uri, name) { var link = document.createElement('a'); link.setAttribute('download', name); link.href = uri; document.body.appendChild(link); link.click(); document.body.removeChild(link); } function get_url (id, tab, cb) { var url = 'https://www.urionlinejudge.com.br/judge/en/runs/code/' + id var newTab = window.open(url, '_blank'); newTab.onload = function () { var ans = newTab.document.getElementsByClassName('dropbox-saver')[0].href; tab.opener.downloadURI(ans, ''); newTab.close(); setTimeout(function() { cb(null)}, 1000 ); }; } function fetch_page (page, cb) { var url = 'https://www.urionlinejudge.com.br/judge/en/runs?answer_id=1&page=' + page; var newTab = window.open(url, '_blank'); newTab.onload = function () { var sub_ids = newTab.document.getElementsByClassName('id'); function go (i) { if (i == sub_ids.length) { newTab.close(); cb(null) return; } else { var id = sub_ids[i].innerText; newTab.opener.get_url(id, newTab, function (err) { if (!err) { go(i + 1); } else { return err; } }); } } go(0) }; } function go (i) { if (i > pages) { return; } else { fetch_page(i + 1, function (err) { if (!err) { setTimeout( function () { go(i + 1); }, 1000); } else { return err; } }); } } var pages = parseInt(document.getElementById('table-info').innerText.split(' ')[2]); go (0)