From e5749dc7fe8cf0113628009dc23e186638591101 Mon Sep 17 00:00:00 2001 From: Anthony Cieri Date: Wed, 10 Jul 2024 20:05:13 -0700 Subject: [PATCH] fix: Use absolute paths --- src/pi_startup/auto_update_service/setup.sh | 8 +- src/pi_startup/startup_stuff/localtesting.sh | 2 + src/pi_startup/startup_stuff/test.py | 32 ++++++ src/pi_startup/startup_stuff/test.sh | 2 +- .../startup_stuff/test_py_output.txt | 102 ++++++++++++++++++ 5 files changed, 142 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/pi_startup/auto_update_service/setup.sh create mode 100644 src/pi_startup/startup_stuff/localtesting.sh create mode 100755 src/pi_startup/startup_stuff/test.py mode change 100644 => 100755 src/pi_startup/startup_stuff/test.sh create mode 100644 src/pi_startup/startup_stuff/test_py_output.txt diff --git a/src/pi_startup/auto_update_service/setup.sh b/src/pi_startup/auto_update_service/setup.sh old mode 100644 new mode 100755 index d3056e1..15e86a0 --- a/src/pi_startup/auto_update_service/setup.sh +++ b/src/pi_startup/auto_update_service/setup.sh @@ -1,9 +1,11 @@ -#! /bin/bash +# No shebang, not executable run this with bash directly # Test script # Runs some other scripts -echo $(pwd) >> testing.txt +echo $(pwd) > testing.txt -bash ../startup_stuff/test.sh +/home/pi/Documents/ug-pi/src/pi_startup/startup_stuff/test.sh + +python3 /home/pi/Documents/ug-pi/src/pi_startup/startup_stuff/test.py > ~/Documents/test_py_output.txt diff --git a/src/pi_startup/startup_stuff/localtesting.sh b/src/pi_startup/startup_stuff/localtesting.sh new file mode 100644 index 0000000..ddfdee0 --- /dev/null +++ b/src/pi_startup/startup_stuff/localtesting.sh @@ -0,0 +1,2 @@ + +python3 $1 > test_py_output.txt diff --git a/src/pi_startup/startup_stuff/test.py b/src/pi_startup/startup_stuff/test.py new file mode 100755 index 0000000..d56d74e --- /dev/null +++ b/src/pi_startup/startup_stuff/test.py @@ -0,0 +1,32 @@ + +# Python script that does something + + + +num = 100 + +fib_memory = [-1] * (num + 1) + +fib_memory[0] = 1 +fib_memory[1] = 1 + + + +def fib(n: int) -> int: + if n <= 1: + return 1 + + if fib_memory[n] == -1: + fib_num = fib(n - 1) + fib(n - 2) + fib_memory[n] = fib_num + + return fib_num + + return fib_memory[n] + + + +print(f"The first {num} Fibonacci Numbers:") + +for i in range(num + 1): + print(f"{i}: {fib(i)}") diff --git a/src/pi_startup/startup_stuff/test.sh b/src/pi_startup/startup_stuff/test.sh old mode 100644 new mode 100755 index 6475067..7a2e085 --- a/src/pi_startup/startup_stuff/test.sh +++ b/src/pi_startup/startup_stuff/test.sh @@ -3,4 +3,4 @@ # Makes a file somewhere -echo $(pwd) >> test2.txt +echo $(pwd) > test2.txt diff --git a/src/pi_startup/startup_stuff/test_py_output.txt b/src/pi_startup/startup_stuff/test_py_output.txt new file mode 100644 index 0000000..d934885 --- /dev/null +++ b/src/pi_startup/startup_stuff/test_py_output.txt @@ -0,0 +1,102 @@ +The first 100 Fibonacci Numbers: +0: 1 +1: 1 +2: 2 +3: 3 +4: 5 +5: 8 +6: 13 +7: 21 +8: 34 +9: 55 +10: 89 +11: 144 +12: 233 +13: 377 +14: 610 +15: 987 +16: 1597 +17: 2584 +18: 4181 +19: 6765 +20: 10946 +21: 17711 +22: 28657 +23: 46368 +24: 75025 +25: 121393 +26: 196418 +27: 317811 +28: 514229 +29: 832040 +30: 1346269 +31: 2178309 +32: 3524578 +33: 5702887 +34: 9227465 +35: 14930352 +36: 24157817 +37: 39088169 +38: 63245986 +39: 102334155 +40: 165580141 +41: 267914296 +42: 433494437 +43: 701408733 +44: 1134903170 +45: 1836311903 +46: 2971215073 +47: 4807526976 +48: 7778742049 +49: 12586269025 +50: 20365011074 +51: 32951280099 +52: 53316291173 +53: 86267571272 +54: 139583862445 +55: 225851433717 +56: 365435296162 +57: 591286729879 +58: 956722026041 +59: 1548008755920 +60: 2504730781961 +61: 4052739537881 +62: 6557470319842 +63: 10610209857723 +64: 17167680177565 +65: 27777890035288 +66: 44945570212853 +67: 72723460248141 +68: 117669030460994 +69: 190392490709135 +70: 308061521170129 +71: 498454011879264 +72: 806515533049393 +73: 1304969544928657 +74: 2111485077978050 +75: 3416454622906707 +76: 5527939700884757 +77: 8944394323791464 +78: 14472334024676221 +79: 23416728348467685 +80: 37889062373143906 +81: 61305790721611591 +82: 99194853094755497 +83: 160500643816367088 +84: 259695496911122585 +85: 420196140727489673 +86: 679891637638612258 +87: 1100087778366101931 +88: 1779979416004714189 +89: 2880067194370816120 +90: 4660046610375530309 +91: 7540113804746346429 +92: 12200160415121876738 +93: 19740274219868223167 +94: 31940434634990099905 +95: 51680708854858323072 +96: 83621143489848422977 +97: 135301852344706746049 +98: 218922995834555169026 +99: 354224848179261915075 +100: 573147844013817084101