diff --git a/python/.vscode/launch.json b/python/.vscode/launch.json new file mode 100644 index 0000000..7774467 --- /dev/null +++ b/python/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "Python Debugger: Current File", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/python/.vscode/settings.json b/python/.vscode/settings.json new file mode 100644 index 0000000..a8c2003 --- /dev/null +++ b/python/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "python-envs.defaultEnvManager": "ms-python.python:conda", + "python-envs.defaultPackageManager": "ms-python.python:conda", + "python-envs.pythonProjects": [] +} \ No newline at end of file diff --git a/python/floatingpoint/main.py b/python/floatingpoint/main.py new file mode 100644 index 0000000..aa85991 --- /dev/null +++ b/python/floatingpoint/main.py @@ -0,0 +1,13 @@ + +import struct + +def float_bin(number): + return bin(struct.unpack(' last_section_page: + return page + + return total_pages + + +def extract_section(): + reader = PdfReader(INPUT_PDF) + writer = PdfWriter() + + outline_tree = build_outline_tree(reader) + total_pages = len(reader.pages) + + target = find_section(outline_tree, TARGET_SECTION_TITLE) + if not target: + raise ValueError(f"Section '{TARGET_SECTION_TITLE}' not found") + + start_page = target["page"] + end_page = find_end_page(target, outline_tree, total_pages) + + for p in range(start_page, end_page): + page = reader.pages[p] + crop_page(page) + writer.add_page(page) + + with open(OUTPUT_PDF, "wb") as f: + writer.write(f) + + print( + f"Extracted '{target['title']}' " + f"(pages {start_page + 1}–{end_page})" + ) + + +if __name__ == "__main__": + extract_section() diff --git a/python/tool-speechtotext/assistant.py b/python/tool-speechtotext/assistant.py index bd94819..f8eca7b 100644 --- a/python/tool-speechtotext/assistant.py +++ b/python/tool-speechtotext/assistant.py @@ -94,7 +94,7 @@ def main(): print("No speech detected. Try again.") continue - # print(f"You said: {text}") + print(f"You said: {text}") pyperclip.copy(text) if (args.nollm == False):