Skip to content

Instantly share code, notes, and snippets.

@miku
Forked from samuell/plot_file_sizes.py
Created May 17, 2017 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miku/abf3866ab058a392003a4957dc6af07f to your computer and use it in GitHub Desktop.
Save miku/abf3866ab058a392003a4957dc6af07f to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from sys import stdin, stdout
import csv
rdr = csv.reader(stdin, delimiter='\t')
wrt = csv.writer(stdout, delimiter='\t')
vals = []
rows = []
for row in rdr:
val = row[0]
val = val.replace(',','.').replace('K', '*1000').replace('M', '*1000000').replace('G', '*1000000000')
exec('val=' + val)
vals.append(val)
rows.append(row)
max = max(vals)
for v, r in zip(vals,rows):
fname = r[1]
graph = ('*'*round((v / max) * 100))
print(fname.rjust(64), graph, r[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment