init
This commit is contained in:
commit
6178771a55
4 changed files with 145 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
venv/
|
14
README.md
Normal file
14
README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Slides for Tech Talks 25
|
||||||
|
|
||||||
|
First run the python script:
|
||||||
|
```
|
||||||
|
python3 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
python3 threadednames.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Then get the PID of the script and do:
|
||||||
|
```
|
||||||
|
top -p <PID> -H -d 0.5
|
||||||
|
```
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pyprctl==0.1.3
|
129
threadednames.py
Normal file
129
threadednames.py
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
|
||||||
|
import pyprctl
|
||||||
|
|
||||||
|
|
||||||
|
slides = []
|
||||||
|
current_slide = 0
|
||||||
|
|
||||||
|
slides.append(("static", """Herzlich
|
||||||
|
Willkommen,
|
||||||
|
zur 26. Auflage
|
||||||
|
der Tech Talks
|
||||||
|
des Kassel Code
|
||||||
|
Meetups in der
|
||||||
|
Caricatura Bar"""))
|
||||||
|
|
||||||
|
slides.append(("static", """
|
||||||
|
Die Agenda fuer
|
||||||
|
Heute:
|
||||||
|
|
||||||
|
19:15 - 19:30
|
||||||
|
Begruessung
|
||||||
|
|
||||||
|
19:30 - 20:00
|
||||||
|
Talk No 1
|
||||||
|
Goodbye
|
||||||
|
Hydration –
|
||||||
|
Resumable Pages
|
||||||
|
mit Qwik
|
||||||
|
Entdecke die
|
||||||
|
Macht der
|
||||||
|
Webcomponents
|
||||||
|
- Sven
|
||||||
|
|
||||||
|
20:00 - 20:30
|
||||||
|
Talk No 2
|
||||||
|
Capture The Flag
|
||||||
|
- Marlon
|
||||||
|
|
||||||
|
20:30 - 21:00
|
||||||
|
Talk No 3
|
||||||
|
Reverse
|
||||||
|
Engineering
|
||||||
|
old
|
||||||
|
Datastructures
|
||||||
|
From System
|
||||||
|
Programming
|
||||||
|
To The Web
|
||||||
|
and back!
|
||||||
|
- Enno
|
||||||
|
|
||||||
|
21:00 - 21:30
|
||||||
|
Pizza
|
||||||
|
|
||||||
|
21:30 - 22:00
|
||||||
|
Whats Next
|
||||||
|
"""))
|
||||||
|
|
||||||
|
slides.append(("walking", """ ______ ____ _ __ ___
|
||||||
|
/_ __/___ _/ / /__ / | / /___ < /
|
||||||
|
/ / / __ `/ / //_/ / |/ / __ \ / /
|
||||||
|
/ / / /_/ / / ,< / /| / /_/ / / /
|
||||||
|
/_/ \__,_/_/_/|_| /_/ |_/\____(_) /_/ """))
|
||||||
|
|
||||||
|
slides.append(("walking", """ ______ ____ _ __ ___
|
||||||
|
/_ __/___ _/ / /__ / | / /___ |__ |
|
||||||
|
/ / / __ `/ / //_/ / |/ / __ \ __/ /
|
||||||
|
/ / / /_/ / / ,< / /| / /_/ / / __/
|
||||||
|
/_/ \__,_/_/_/|_| /_/ |_/\____(_) /____/ """))
|
||||||
|
|
||||||
|
slides.append(("walking", """ ______ ____ _ __ _____
|
||||||
|
/_ __/___ _/ / /__ / | / /___ |__ /
|
||||||
|
/ / / __ `/ / //_/ / |/ / __ \ /_ <
|
||||||
|
/ / / /_/ / / ,< / /| / /_/ / ___/ /
|
||||||
|
/_/ \__,_/_/_/|_| /_/ |_/\____(_) /____/ """))
|
||||||
|
|
||||||
|
slides.append(("walking", """ ____ ______________ ___ ______
|
||||||
|
/ __ \/ _/__ /__ / / | / / / /
|
||||||
|
/ /_/ // / / / / / / /| | / / / /
|
||||||
|
/ ____// / / /__/ /__/ ___ |/_/_/_/
|
||||||
|
/_/ /___/ /____/____/_/ |_(_|_|_) """))
|
||||||
|
|
||||||
|
|
||||||
|
def create_named_thread(name: str, slide: int) -> None:
|
||||||
|
pyprctl.set_name(name)
|
||||||
|
while current_slide == slide:
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
def create_walking_thread(name: str, slide: int) -> None:
|
||||||
|
nth = 0
|
||||||
|
while current_slide == slide:
|
||||||
|
pyprctl.set_name(name[nth % len(name):nth + 15])
|
||||||
|
nth = nth + 1
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
|
||||||
|
def render_slide() -> None:
|
||||||
|
if slides[current_slide][0] == "static":
|
||||||
|
for line in slides[current_slide][1].split('\n'):
|
||||||
|
threading.Thread(target=create_named_thread, args=(line, current_slide)).start()
|
||||||
|
if slides[current_slide][0] == "walking":
|
||||||
|
for line in slides[current_slide][1].split('\n'):
|
||||||
|
threading.Thread(target=create_walking_thread, args=(line, current_slide)).start()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
render_slide()
|
||||||
|
print(f"run: 'top -p {os.getpid()} -H -d 0.5' to view the presentation")
|
||||||
|
while True:
|
||||||
|
print(slides[current_slide][1])
|
||||||
|
nav = input("j -> Next, k -> previous, q -> quit : ")
|
||||||
|
|
||||||
|
if nav =='j':
|
||||||
|
current_slide += 1
|
||||||
|
if nav == 'k':
|
||||||
|
current_slide -= 1
|
||||||
|
if nav == 'q':
|
||||||
|
os.kill(os.getpid(), signal.SIGTERM)
|
||||||
|
|
||||||
|
if current_slide < 0:
|
||||||
|
current_slide = 0
|
||||||
|
if current_slide > len(slides) - 1:
|
||||||
|
current_slide = len(slides) - 1
|
||||||
|
render_slide()
|
||||||
|
|
Loading…
Reference in a new issue