My omnium-gatherom of scripts and source code.
1from os import system, popen
2from time import sleep
3from datetime import datetime
4from calendar import timegm
5
6
7def make_bar(start_t: int, end_t: int) -> str:
8 bar_len: int = 46
9 date = datetime.utcnow()
10 now_t: int = timegm(date.utctimetuple())
11 percent: float = ((now_t - start_t) / float(end_t - start_t))
12 com_c: str = "#" * int(percent * bar_len)
13 rem_c: str = "-" * (bar_len - len(com_c))
14 seconds: int = (now_t - end_t) % 60
15 minutes: int = (now_t - end_t) / 60
16 return f"{minutes:0>2.0f}:{seconds:0>2} [{com_c}{rem_c}] {percent:>3.0%}"
17
18
19rows, cols = popen('stty size', 'r').read().split()
20date = datetime.utcnow()
21utc_now = calendar.timegm(date.utctimetuple())
22bar = make_bar(utc_now - 1800, utc_now).rjust(int(cols))
23print(bar)