added shebangs

This commit is contained in:
Christoph J. Scherr 2023-04-20 22:52:52 +02:00
parent c2dbb38afe
commit c9ef787521
7 changed files with 35 additions and 4 deletions

3
src/adder.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import sys
if __name__ == "__main__":
@ -6,4 +7,4 @@ if __name__ == "__main__":
for arg in sys.argv:
if(arg.isdecimal()):
result += int(arg)
print(result)
print(result)

3
src/args.py Normal file → Executable file
View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys
if __name__ == "__main__":
print(f"Arguments count: {len(sys.argv)}")
for i, arg in enumerate(sys.argv):
print(f"Argument {i:>6}: {arg}")
print(f"Argument {i:>6}: {arg}")

1
src/class-incest.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
class Root():
a = "Root"
def f(self):

3
src/hello.py Normal file → Executable file
View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3
print("hello world!\n")
for i in range(10):
if(i<9):
print((i)*"hello-"+"hello")
elif(i==0):
print("hello")
print("hello")

25
src/my-curses.py Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# stolen from stackoverflow: https://stackoverflow.com/questions/6840420/rewrite-multiple-lines-in-the-console
# breaks if filename is curses.py
import curses
import time
def report_progress(filename, progress):
"""progress: 0-10"""
stdscr.addstr(0, 0, "Moving file: {0}".format(filename))
stdscr.addstr(1, 0, "Total progress: [{1:10}] {0}%".format(progress * 10, "#" * progress))
stdscr.refresh()
if __name__ == "__main__":
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
try:
for i in range(10):
report_progress("file_{0}.txt".format(i), i+1)
time.sleep(0.5)
finally:
curses.echo()
curses.nocbreak()
curses.endwin()

1
src/randomString.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import random
import string

3
src/simple-calc.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import sys
if __name__ == "__main__":
@ -62,4 +63,4 @@ if __name__ == "__main__":
else:
print(f"'{op}' is not a valid operator")
sys.exit()