🎉 Added python test scripts for prep of bgit
This commit is contained in:
parent
08ddb8a1e0
commit
5f9bd1cd3a
3 changed files with 42 additions and 0 deletions
12
scripts/python/test.py
Normal file
12
scripts/python/test.py
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# https://www.simplilearn.com/tutorials/python-tutorial/subprocess-in-python
|
||||||
|
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
|
process = Popen(['cat', 'example.txt'], stdout=PIPE, stderr=PIPE)
|
||||||
|
|
||||||
|
stdout,stderr = process.communicate()
|
||||||
|
|
||||||
|
print(stdout)
|
||||||
|
|
||||||
|
# import subprocess
|
||||||
|
# subprocess.call(["git", "status"])
|
||||||
17
scripts/python/timer
Executable file
17
scripts/python/timer
Executable file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
# https://realpython.com/python-subprocess/
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
parser = ArgumentParser()
|
||||||
|
parser.add_argument("time", type=int)
|
||||||
|
args = parser.parse_args()
|
||||||
|
print(f"Starting timer of {args.time} seconds")
|
||||||
|
for _ in range(args.time):
|
||||||
|
print(".", end="", flush=True)
|
||||||
|
sleep(1)
|
||||||
|
# print("Done!")
|
||||||
|
subprocess.call(["notify-send", "Done!"])
|
||||||
13
scripts/python/timer.py
Normal file
13
scripts/python/timer.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# https://realpython.com/python-subprocess/
|
||||||
|
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
parser = ArgumentParser()
|
||||||
|
parser.add_argument("time", type=int)
|
||||||
|
args = parser.parse_args()
|
||||||
|
print(f"Starting timer of {args.time} seconds")
|
||||||
|
for _ in range(args.time):
|
||||||
|
print(".", end="", flush=True)
|
||||||
|
sleep(1)
|
||||||
|
print("Done!")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue