Giter Site home page Giter Site logo

Comments (10)

knorrie avatar knorrie commented on May 28, 2024

Hi, nice idea, I like it!

Especially the pipe into ascii art viewer part is cool, since it provides a quick way to view the situation on a remote server while being logged in over ssh into a terminal (without having to rm the image file again etc). In combination with a helper program like 'timeout' and an infinite loop around it, you have a live refreshing self-updating image in the terminal, without writing an intermediate file.

What I did before while trying out things (on local computer) all the time was using an image viewer with inotify support like gthumb and then just overwriting the same file every time, having the viewer update automatically.

So, how to do this? When writing the png to stdout, all other text output has to be suppressed of course, but that's easy.

What's more difficult is that the png format is not "streaming-friendly" at all, since it has a length field which value we only know after writing all output. In the file writer code, I just jump back to that spot and then write the value, but that's obviously not possible when streaming to stdout:

# Go back and write length of the IDAT

So, instead it needs to generate everything in memory. That's not a big deal, since the memory needed is much less than the complete pixel grid which is already kept in memory in a very inefficient (but very convenient) way. :D

from btrfs-heatmap.

microraptor avatar microraptor commented on May 28, 2024

I don't have much time right now, but I actually took a quick look at the code and did some testing. I noticed the problem with .seek() you mentioned, so the whole image needs to be buffered, and also that sys.stdout doesn't accept binary out of the box.

Using it in an SSH session and in a loop was my thought as well. It would be great to watch a defragmentation or balance operation going on with something like this:
while :; do sudo heatmap.py --size 6 / -o - | catimg -; sleep 5; done

Edit: fixed above command

from btrfs-heatmap.

knorrie avatar knorrie commented on May 28, 2024

I tried catimg, it does not accept data from stdin. Do you have another catimg than I found, or didn't you try catimg - < pngfile yet?

I do like the result of what catimg shows more than cacaview or asciiview by the way. Unfortunately, it's also taking its time to produce it.

from btrfs-heatmap.

knorrie avatar knorrie commented on May 28, 2024

Oh wait, nevermind, there's a script and a C version (with stdin support). Bedtime, apparently. :)

from btrfs-heatmap.

microraptor avatar microraptor commented on May 28, 2024

Exactly, the C version works with stdin and is pretty fast. The ANSI output of it makes a lot more sense then the ASCII symbols of the other tools.

from btrfs-heatmap.

microraptor avatar microraptor commented on May 28, 2024

The images look also the best if the the resolution of the catimg image is a power of two. So either by using something like -w 128 with catimg or --size 6 with heatmap.py in order to fit it inside the terminal.

from btrfs-heatmap.

knorrie avatar knorrie commented on May 28, 2024

Oh, and catimg is also in Debian now. Great! I was just looking around on a Stretch system yesterday and didn't find it, but it's in Buster. Let me try to create a PoC branch first so that you can play around with it. I'm thinking about just using a dirty list to write into and some duck typing for creating a yolo memory buffer and not having to put workarounds in the 30 line png generator that I was so proud of. ;-]

from btrfs-heatmap.

knorrie avatar knorrie commented on May 28, 2024

Hey! You can try out the develop branch!

This is awesome. I will also add this to the documentation.

from btrfs-heatmap.

microraptor avatar microraptor commented on May 28, 2024

Thanks, this is great! The pipe to | catimg - and | feh - & works perfectly for me!

from btrfs-heatmap.

knorrie avatar knorrie commented on May 28, 2024

Ah, I'll also add feh as suggestion in the documentation yes.

from btrfs-heatmap.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.