- Notifications
You must be signed in to change notification settings - Fork1
hi-res sparklines for your shell
License
muhqu/superspark
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Inspired byZach Holman'sspark, it brings sparklines, with greater detail, to your shell.
See the demo:
superspark
is ashell script that wraps arround a tinyphp command line script. For it to run you need php 5.3 (or above) and need to place the script somewhere on your$PATH
.
wget https://raw.github.com/muhqu/superspark/master/superspark \ -O /usr/local/bin/supersparkchmod +x /usr/local/bin/supersparksuperspark -h
Read values via script arguments.
$ superspark 1 2 3 5 8 15 26 ̄̄ ̄̄̄ ̄̄̄̄ ̄̄̄̄̄ ̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄
Read values fromstdin. One value per line.
$ seq 0 18| superspark ̄ ̄̄ ̄̄̄ ̄̄̄̄ ̄̄̄̄̄ ̄̄̄̄̄̄ ̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄
Repeatedly execCMD
to read values. One value per line. SleepN
seconds between redraws.
$ superspark -n 1 -c"seq 0 40 | awk '{ printf\"%6d\\n\", (sin((systime()+\$1)/2)*cos((systime()+\$1)/4)+1)*20; }'" ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄ ̄̄̄̄ ̄̄̄̄ ̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄ ̄̄̄̄̄ ̄̄̄̄ ̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄ ̄̄̄̄ ̄̄̄̄ ̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄ ̄̄̄̄ ̄̄̄̄̄ ̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄
Continuously read fromstdin and draw an accumulated graph with every new value. One value per line.
$ ping -n localhost| awk'BEGIN{FS="time=|ms"}{ printf "%d\n", $2*1000;fflush();}'| superspark -s -L ̄ ̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ ̄̄̄̄̄̄̄̄̄̄̄̄̄̄̄ min: 0 max: 126 curr: 93 mean: 98.79
The sparklines are assembled using the unicodecombining characterU+0304
which is namedCOMBINING MACRON. ...like an apostrophe dash. So, this obviously only works on full-fledged UTF-8 enabled terminals... e.g.iTerm 2, Terminal.app on Mac. Don't know about windows/linux support yet...
© 2013 by Mathias Leppich github.com/muhqu,@muhqu | |