Eclectic Media Git pingstats / ab1d4c0
Made graph scale to terminal size Ariana Giroux 1 year, 9 months ago
3 changed file(s) with 18 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
1010 Installation has been made easy on any Unix based system that implements ``wget`` and ``pip3``.
1111 ::
1212
13 $ wget -O - https://gitlab.com/EclectickMediaSolutions/pingstats/raw/master/install.sh
13 $ wget -O - https://gitlab.com/EclectickMediaSolutions/pingstats/raw/master/install.sh | bash
1414
1515 USAGE
1616 =====
2020
2121 parser.add_argument('address', help='The address to ping. This could be either '
2222 'a web address (i.e, "google.ca") or an IP address.')
23
24
25 def _get_tty_size():
26 temp_file = NamedTemporaryFile()
27
28 p = Popen('stty size'.split(), stdout=temp_file)
29 p.wait()
30
31 with open(temp_file.name) as f:
32 rows, columns = f.read().split()
33 rows = int(rows)
34 columns = int(columns)
35
36 return rows, columns
2337
2438
2539 def run():
5872 time.sleep(0.5 - (time.time() - time_start))
5973
6074 system('clear' if not name == 'nt' else 'cls')
61 plot(y)
75 rows, columns = _get_tty_size()
76 plot(y, num_x_chars=columns - 14, num_y_chars=rows)
6277 except KeyboardInterrupt:
6378 pass
6479
11
22 setup(
33 name='pingstats',
4 version='0.3.2',
4 version='0.3.4',
55 description='Simple ping visualization on the CLI',
66 url='http://gitlab.com/eclectickmediasolutions/pingstats',
77 author='Ariana Giroux',