-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathos_stimulate.py
More file actions
35 lines (31 loc) · 852 Bytes
/
os_stimulate.py
File metadata and controls
35 lines (31 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''
My laptop is weird. Running this script makes opening and terminating processes faster.
Speculation: Taking CPU time away from Windows Defender?
'''
DEFAULT_INTERVAL = 5
print('Interval =', DEFAULT_INTERVAL, end = '\r')
print('Interval = ', end = '', flush = True)
from subprocess import Popen
from time import sleep
from os import kill
SIGKILL: int = 9
def main():
try:
interval: int = int(input())
assert interval > 0
except:
interval = DEFAULT_INTERVAL
while True:
print('open')
p: Popen = Popen('taskmgr')
sleepLoud(interval)
print('kill')
kill(p.pid, SIGKILL)
sleepLoud(2)
def sleepLoud(length):
assert type(length) is int
for i in range(length):
print(i, end = '', flush = True)
sleep(1)
if __name__ == '__main__':
main()