This reminds me of another useful utility from the childhood: alias updick='/usr/bin/uptime | perl -ne "/(\d+) d/;print 8,q(=)x\$1,\"D\n\""'
Spark
61–70 of 100 posts
Re: Spark
#62Just did a Haskell version of spark. It supports in 9 lines of code (exclude comment + empty line) Double instead of just Int. Negative numbers. https://github.com/Mgccl/mgccl-haskell/blob/master/random/sp...
Now, without the type declaration, white space, comments, it's only 6 lines, and looks even better. :)
Re: Spark
#63Earlier quoted context omitted.
Thanks! First time I've heard of "sparkline". Of course I've seen these items for as long as I can remember, but I just call them "graphs". :P
A sparkline is a specific type of graph used for certain types of data. The wiki page is pretty clear with the uses and limitations. Not all graphs are created equal, it's important to use the right tool for the job. This tool isnt just a graph generator, it's a spark bar chart generator that's compact enough to fit in the command line. Overall a cool idea.
> A sparkline is a specific type of graph
My point is this should be explained _somewhere_. Anybody else unfamiliar with sparklines will now have the benefit of this thread. Previously, to me anyway, it was a mystery.
> The wiki page is pretty clear with the uses and limitations.
It is. It was only presented upon my initial query, and am grateful to @IgorPartola for providing!
> Not all graphs are created equal, it's important to use the right > tool for the job. This tool isnt just a graph generator, > it's a > spark bar chart generator that's compact enough to fit in > the > command line. Overall a cool idea.
It is, indeed. My initial note wasn't about the coolness of the project, just "what _is_ the project"? Is clear now. Anybody else who is ignorant about sparklines as I was, enjoy this thread!
Re: Spark
#64Nice: found a spark line generator at http://sandbox.kidstrythisathome.com/louis/ : ⡠⠞⠉⠙⠦⣀⠴⠋⠉⠳⢄⡠⠞⠉⠙⠦⣀⠴⠋⠉⠳⢄
Re: Spark
#65Just did a Haskell version of spark. It supports in 9 lines of code (exclude comment + empty line) Double instead of just Int. Negative numbers. https://github.com/Mgccl/mgccl-haskell/blob/master/random/sp...
https://gist.github.com/1367709
mapNormalize takes a function, and produces a function that runs that function with the normalized input. It runs in a single iteration, rather than 2 maps. Credit to `dylex` for much hand holding on a single iteration normalizer :)
Re: Spark
#66Earlier quoted context omitted.
No idea. Here they are for everyone's use: ticks = " ▁▂▃▄▅▆▇█" I've included SPACE as well. That's an obvious missing one.
At least in my OS/X terminal using the "Monaco" font (which I think is the default), the final one (U+2588) doesn't descend as far as the rest of the characters. It really produces some ugly output with that one included. Including the space character means that you lose a nice baseline if the input is fairly sparse, so it looks less like a bar graph and more like just some random blobs.
Re: Spark
#67$ spark 3,4,9 ▃▇▇
huh?
Re: Spark
#68▁▁▁▁▅▁▇▁▁▅▁▁▁▁▁▂▂▁▃▃▁▁▃▁▃▁▂▁▁▂▂▅▂▃▂▃▃▁▆▃▃▃▁▇▁▁▂▂▂▇▅▁▂▂▁▇▁▃▁▇▁▂▁▇▁▁▆▂▁▇▁▂▁▁▂▅▁▂▁▆▇▇▂▁▂▁▁▁▂▂▁▅▁▂▁▁▃▁▃▁▁▁▃▂▂▂▁▁▅▂▁▁▁▁▂▂▁▁▁▂▂$
Ship it.
Re: Spark
#69Just did a Haskell version of spark. It supports in 9 lines of code (exclude comment + empty line) Double instead of just Int. Negative numbers. https://github.com/Mgccl/mgccl-haskell/blob/master/random/sp...
Re: Spark
#70Cool. I also like that he set up a wiki where people can contribute interesting spark one liners: https://github.com/holman/spark/wiki/Wicked-Cool-Usage
Perhaps common uses could be wrapped in options to the script? For instance, an option to graph numbers on separate lines, to graph all numbers in the input in order, to graph a specific column of information (like passing through cut first) or to graph commonly graphed sources?