From fc57dabc601a0ac41e95c9bf353d7c56fb4ac075 Mon Sep 17 00:00:00 2001 From: Alex Chi Z Date: Wed, 27 Dec 2023 23:25:33 +0800 Subject: [PATCH] add request signature script (#674) * add request signature script Signed-off-by: Alex Chi * chmod 755 Signed-off-by: Alex Chi * more info Signed-off-by: Alex Chi * update template Signed-off-by: Alex Chi * fix typo Signed-off-by: Alex Chi * rm Your Signed-off-by: Alex Chi --------- Signed-off-by: Alex Chi --- GRADESCOPE.md.template | 91 +++++---------------------------- gradescope_sign.py | 111 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 78 deletions(-) create mode 100755 gradescope_sign.py diff --git a/GRADESCOPE.md.template b/GRADESCOPE.md.template index 1ab687a9b..2d33bb799 100644 --- a/GRADESCOPE.md.template +++ b/GRADESCOPE.md.template @@ -1,83 +1,18 @@ -# BusTub Non-CMU Gradescope - -To create a fair learning environment for all students and avoid potential -Academic Integrity Violations within CMU, we ask you to AVOID making your -BusTub repository public on GitHub. If you are not a student from CMU, you will -need to sign this document before submitting to Gradescope. - -Please sign this document by filling your information in the form and include -this file along with your submission. Firstly, run the following command to copy -this file: - -``` -cp GRADESCOPE.md.template GRADESCOPE.md -``` - -Then, please read the following agreement and fill in the signature below. - -```plain -I hereby agree to the terms outlined in this agreement ("Agreement"). By -signing this Agreement, I acknowledge that I have read, understood, and will -comply with the following terms and conditions: - -1. Respect for System Security: I understand and acknowledge that the Gradescope - system, which is used for the submission and grading of assignments, projects, - and examinations, is a secure platform. I agree to respect the security measures - implemented by Gradescope and will not engage in any activities that could - compromise the integrity, functionality, or security of the system. - - TL;DR: DO NOT try to retrieve private test cases from the autograder. They are - not meant to be used by students in their local development environment. - -2. Academic Integrity: I affirm that the work I submit for assessment, - including assignments, projects, and examinations, is my original work. I - understand that cheating, plagiarism, or any form of academic dishonesty is - strictly prohibited by the School/Organization's policies, and any violation - will result in appropriate disciplinary action, which may include academic - penalties and sanctions. - - TL;DR: DO submit your own work. - -3. Prohibition on Publishing: I agree not to publish, upload, or otherwise make - available any solutions, code, assignments, projects, or related materials - provided by the School/Organization that are designated as confidential or - proprietary to any public repositories on GitHub or any other online - platforms accessible to the public. This includes but is not limited to - personal repositories, organizational repositories, public gists, and forums. - - TL;DR: DO NOT publish your project solution anywhere. You may publish blog - posts on your general approach and ideas about the project, but DO NOT - publish it before the CMU deadline for that project, and DO NOT publish code. - -4. No Official Help: I understand and acknowledge that the School/Organization - does not offer official assistance or support for technical, academic, or - non-academic matters. This includes, but is not limited to, help with - assignments, projects, technical troubleshooting, academic advising, and - administrative inquiries. - - TL;DR: This is an unofficial Gradescope for 15-445/645 course. DO NOT submit - issues to the BusTub repo regarding Gradescope issues. There is an - unofficial Discord server, but neither TAs or professors will actively - monitor it. See the course FAQ for the Discord link. - -===BEGIN SIGNATURE=== -Student's GitHub ID: -Student's Legal Name: -Student's Organization/School Name: -Student's Email: +To create a fair learning environment for all students and avoid potential Academic Integrity Violations within Carnegie Mellon University, we ask you to sign this short agreement before submitting to Gradescope. + +1. I agree NOT to make my solution public. i.e., DO NOT make it public on GitHub or create videos explaining the solution code. +2. I agree NOT to hack Gradescope. i.e., DO NOT retrieve private test cases from Gradescope, or bypass correctness checks. +3. I affirm that the work I submit for assessment is my original work. i.e., DO NOT purchase/copy solution from others. +4. I understand that the course staff does not provide official help for students outside CMU. i.e., DO NOT email the course staff or create GitHub issues for course-related questions. Use the unofficial Discord server. +I understand that if I violate the rules, I will be banned from using Gradescope. + +Name: +Affiliation (School/Company): +Email: +GitHub ID: Date: -=== END SIGNATURE === -``` - -* Note: Your email should be the same as your Gradescope email. Please use the email - from your academic affiliation if possible. -* Note: If you do not have a GitHub account, please fill in N/A. -* Note: If you are not affiliated with any organization, you can fill in - the third line with N/A. -The `make submit-pX` command will automatically include this file (TBD) and the -grader will grade your submission. Thank you for your interest in the BusTub -project, and thank you for helping us create a fair learning environment. +I understand that if I provide a fake signature, I will be banned from using Gradescope. [id]: bustub-non-cmu-gradescope-23333 diff --git a/gradescope_sign.py b/gradescope_sign.py new file mode 100755 index 000000000..f6ee87829 --- /dev/null +++ b/gradescope_sign.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 + +from datetime import datetime +from pathlib import Path +import subprocess + + +def request_yn(buffer, msg): + print(msg, end="") + print(" [y/N] ", end="") + yn = input() + assert yn == "y" + buffer += msg + buffer += "\n" + return buffer + + +def request_sign(buffer, msg): + print(msg, end="") + print(" ", end="") + data = input() + assert len(data) >= 2 + buffer += msg + buffer += " " + buffer += data + buffer += "\n" + return buffer + + +def request_date(buffer, msg): + print(msg, end="") + buffer += msg + date = datetime.today().strftime("%Y-%m-%d") + print(" " + date) + buffer += " " + buffer += date + buffer += "\n" + return buffer + + +def add_to_submission(): + for item in Path().iterdir(): + name = item.name + if name.startswith("project") and name.endswith("-submission.zip"): + print("adding GRADESCOPE.md to", name) + subprocess.run(["zip", name, "GRADESCOPE.md"]) + + +def main(): + if Path("GRADESCOPE.md").exists(): + print("Found existing signature GRADESCOPE.md, adding to all submissions...") + add_to_submission() + print( + "If you want to make modifications to signed document, run `rm GRADESCOPE.md` and then run this script again." + ) + return + buffer = "" + buffer = request_yn( + buffer, + "To create a fair learning environment for all students and avoid potential Academic Integrity Violations within Carnegie Mellon University, we ask you to sign this short agreement before submitting to Gradescope.", + ) + buffer += "\n" + buffer = request_yn( + buffer, + "1. I agree NOT to make my solution public. i.e., DO NOT make it public on GitHub or create videos explaining the solution code.", + ) + buffer = request_yn( + buffer, + "2. I agree NOT to hack Gradescope. i.e., DO NOT retrieve private test cases from Gradescope, or bypass correctness checks.", + ) + buffer = request_yn( + buffer, + "3. I affirm that the work I submit for assessment is my original work. i.e., DO NOT purchase/copy solution from others.", + ) + buffer = request_yn( + buffer, + "4. I understand that the course staff does not provide official help for students outside CMU. i.e., DO NOT email the course staff or create GitHub issues for course-related questions. Use the unofficial Discord server.", + ) + buffer = request_yn( + buffer, + "I understand that if I violate the rules, I will be banned from using Gradescope.", + ) + buffer += "\n" + buffer = request_sign(buffer, "Name:") + buffer = request_sign(buffer, "Affiliation (School/Company):") + buffer = request_sign(buffer, "Email:") + buffer = request_sign(buffer, "GitHub ID:") + buffer = request_date(buffer, "Date:") + buffer += "\n" + buffer = request_yn( + buffer, + "I understand that if I provide a fake signature, I will be banned from using Gradescope.", + ) + print() + print("--- THIS IS A COPY OF THE SIGNED DOCUMENT ---") + print(buffer) + print("--- END OF THE SIGNED DOCUMENT ---") + print() + print( + "Saving the signature to GRADESCOPE.md and adding the signed document to submission zips..." + ) + Path("GRADESCOPE.md").write_text(buffer) + add_to_submission() + print("Run this script again if you create new submission zips.") + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + print("\nthe sign process was aborted")