From 6d10ae8c7ee882b3565dfeaa55ba5b9a4af63192 Mon Sep 17 00:00:00 2001 From: Boyan Date: Fri, 1 Dec 2023 13:42:58 +0100 Subject: [PATCH] lol --- .gitignore | 10 +++++ kattis/.vscode/settings.json | 5 --- kattis/.vscode/tasks.json | 28 ------------- kattis/kattis.py | 76 ------------------------------------ 4 files changed, 10 insertions(+), 109 deletions(-) delete mode 100644 kattis/.vscode/settings.json delete mode 100644 kattis/.vscode/tasks.json delete mode 100644 kattis/kattis.py diff --git a/.gitignore b/.gitignore index cb09125..767c5ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Trying to not leak credentials +kattis.py + # ---> Python # Byte-compiled / optimized / DLL files __pycache__/ @@ -83,6 +86,13 @@ target/ profile_default/ ipython_config.py + +# VSCode +.vscode/ + +# Env +.env/ + # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: diff --git a/kattis/.vscode/settings.json b/kattis/.vscode/settings.json deleted file mode 100644 index d160145..0000000 --- a/kattis/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "files.associations": { - "stdlib.h": "c" - } -} \ No newline at end of file diff --git a/kattis/.vscode/tasks.json b/kattis/.vscode/tasks.json deleted file mode 100644 index 14f0948..0000000 --- a/kattis/.vscode/tasks.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "tasks": [ - { - "type": "cppbuild", - "label": "C/C++: gcc build active file", - "command": "/sbin/gcc", - "args": [ - "-fdiagnostics-color=always", - "-g", - "${file}", - "-o", - "${fileDirname}/${fileBasenameNoExtension}" - ], - "options": { - "cwd": "${fileDirname}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - }, - "detail": "Task generated by Debugger." - } - ], - "version": "2.0.0" -} \ No newline at end of file diff --git a/kattis/kattis.py b/kattis/kattis.py deleted file mode 100644 index f4e6e94..0000000 --- a/kattis/kattis.py +++ /dev/null @@ -1,76 +0,0 @@ -from autokattis import Kattis -import argparse -from os import system -from requests import get -from bs4 import BeautifulSoup -from datetime import datetime - -def prepare_problem(problem): - system('firefox ' + problem['link']) - name = " " - try: - name = problem['pid'] - except: - name = problem['name'] - - # system('mkdir problems/' + datetime.now.strftime("%d_%m_%y") + "/" name) - - # TODO: Add inputs - r = get(problem['link']) - # tables = soup.find_all('table') - # soup = BeautifulSoup(r.text, 'html.parser') - # for table in tables: - # with open("problems/" + problem['pid'] + "/"+ str(count) + ".in", "w") as f: - # f.write(table[0].text) - # print(table.text) - -def find_user(ranklist:dict) -> int: - for i in ranklist: - if i['username'] == 'confestim': - return i['rank'] - return -1 - -parser = argparse.ArgumentParser(description='Kattis submission tool') -parser.add_argument('-p', metavar='problem', type=str, help='problem name') -parser.add_argument('-pl', action='store_true', default=False, help='plot problem') -parser.add_argument('-s', action='store_true', default=False, help='suggest problem') -parser.add_argument('-r', action='store_true', default=False, help='Show ranklist') -parser.add_argument('-u', action="store_true", default=False, help="ShowStarted, but Unsolved") - -args = parser.parse_args() - -kt = Kattis('confestim', 'changed the password i leaked im sorry', ) -problem = args.p -plot = args.pl -suggest = args.s -unsolved = args.u - -if args.r: - uni = find_user(kt.ranklist(university='University of Groningen')) - country = find_user(kt.ranklist(country='Bulgaria')) - print("🎓:" + str(uni) + ", 🤻 :" + str(country)) -if plot: - print(kt.plot_problems(show_partial=False)) - -if suggest: - for i in kt.suggest(): - prepare_problem(i) - -def stars(problem): - return problem["difficulty"] - -if unsolved: - problems = kt.problems(show_solved=False, show_tried=True) - problems.sort(key=stars) - print(str(len(problems)) + " problems unsolved.") - for problem in problems: - print(f"✱ {problem['name']} {problem['difficulty']}✪") - yn = input("Do you want to open them in browser?(Y/n)") - if (yn == 'n' or yn == 'N'): - pass - else: - for problem in problems: - prepare_problem(problem) - -elif problem: - print(kt.problem(problem))