From 43b7bcebff1c63d7ec06b25ef09b8f902255065a Mon Sep 17 00:00:00 2001 From: arzumify Date: Fri, 29 Mar 2024 19:59:40 +0000 Subject: [PATCH] Added live editing (server) --- cleardb.py | 20 ++++++++++++++++++++ fixapi.sh | 8 ++++++++ 2 files changed, 28 insertions(+) create mode 100644 cleardb.py create mode 100755 fixapi.sh diff --git a/cleardb.py b/cleardb.py new file mode 100644 index 0000000..d9a6c87 --- /dev/null +++ b/cleardb.py @@ -0,0 +1,20 @@ +import time +import subprocess + +def run_init_db(): + # Run the init_db.py script using subprocess + try: + subprocess.run(["python", "init_db"]) + except Exception as e: + print("Error:", e) + +def main(): + while True: + # Run init_db.py + run_init_db() + + # Wait for 5 minutes before running again + time.sleep(300) # 300 seconds = 5 minutes + +if __name__ == "__main__": + main() diff --git a/fixapi.sh b/fixapi.sh new file mode 100755 index 0000000..f3dc8bd --- /dev/null +++ b/fixapi.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Define the old and new URLs +OLD_URL="https://notes.canary.hectabit.org/api" +NEW_URL="https://notes.canary.hectabit.org/api" + +# Recursively search and replace in files under the current directory +find . -type f -exec sed -i "s|$OLD_URL|$NEW_URL|g" {} +