Live data from Hacker News

Spark

github.com

61–70 of 100 posts

Re: Spark

#61
post #15

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\""'

You cracked my office up. Deploying to production immediately.

Re: Spark

#62
post #28

Just 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...

Updated. thx to gwern. Now I know the existence of hlint.

Now, without the type declaration, white space, comments, it's only 6 lines, and looks even better. :)

Re: Spark

#63
post #60
post #59

Earlier 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.

I feel like I'm being reprimanded. Forgive me if I'm mistaken.

> 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

#64
post #56

Nice: found a spark line generator at http://sandbox.kidstrythisathome.com/louis/ : ⡠⠞⠉⠙⠦⣀⠴⠋⠉⠳⢄⡠⠞⠉⠙⠦⣀⠴⠋⠉⠳⢄

Needs a lot more characters to handle height progressions and angles better, but that's awesome.

Re: Spark

#65
post #28

Just 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...

Here's a Haskell version that uses a single loop to do the normalizing, and has a main that doesn't use do syntax. This was mostly a nice little brainteaser:

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

#66
post #43

Earlier 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.

Yes, on the mac it seems only menlo renders it correctly, (vs all the other fixed with font families that bork the rendering in various ways)

Re: Spark

#68
Because I want my shell prompt to be a giant graph.

▁▁▁▁▅▁▇▁▁▅▁▁▁▁▁▂▂▁▃▃▁▁▃▁▃▁▂▁▁▂▂▅▂▃▂▃▃▁▆▃▃▃▁▇▁▁▂▂▂▇▅▁▂▂▁▇▁▃▁▇▁▂▁▇▁▁▆▂▁▇▁▂▁▁▂▅▁▂▁▆▇▇▂▁▂▁▁▁▂▂▁▅▁▂▁▁▃▁▃▁▁▁▃▂▂▂▁▁▅▂▁▁▁▁▂▂▁▁▁▂▂$

Ship it.

Re: Spark

#70
post #12

Cool. 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

All involve awk or sed. That cuts out a large portion of the potential userbase...

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?

Post reply on HN