[HN Gopher] GNU poke 1.0
       ___________________________________________________________________
        
       GNU poke 1.0
        
       Author : todsacerdoti
       Score  : 117 points
       Date   : 2021-02-26 13:21 UTC (9 hours ago)
        
 (HTM) web link (www.jemarch.net)
 (TXT) w3m dump (www.jemarch.net)
        
       | SloopJon wrote:
       | One thing I haven't had much success with when trying editors
       | like this is dealing with variable data, like Pascal-style
       | strings or varints. Another one is a length field that is either
       | one byte, or a NUL byte followed by two bytes, or three NUL bytes
       | followed by four bytes.
       | 
       | I'll have to give this one a try. It would be nice to be able to
       | sift through binary data like bytecode or some non-standard
       | serialization format without writing a one-off utility for it.
        
         | kenny11 wrote:
         | I spent a long time looking for something similar to sift
         | through binary files and found this:
         | 
         | https://www.sweetscape.com/010editor/
         | 
         | It lets you write "templates" in a weird hybrid syntax that
         | looks a lot like a C header file but also allows control
         | statements that can decode complicated data structures in a few
         | lines of script. It looks to have very similar capabilities to
         | GNU Poke, but with a GUI.
        
           | chris_wot wrote:
           | The poke creator seems to have a very dim view of 010.
        
         | digikata wrote:
         | I recently tried Kaitai for something like this. It worked for
         | some nontrivial cases, but I felt like I kept getting bitten by
         | syntax limitations. All the way through, I kept wondering if
         | writing a one off utility might be faster. But it was possible
         | to express variable structures, sizes and counts. I was using
         | the syntax and the cmd line visualizer, but might have been
         | more productive with their html/gui tooling.
         | 
         | http://kaitai.io/
        
       | jtvjan wrote:
       | Oh. I thought it was a free software, federated implementation of
       | Facebook's "poking" feature.
        
         | jonathankoren wrote:
         | I thought this was clone Yo.
         | 
         | https://slate.com/business/2014/06/marc-andreessen-explains-...
        
         | corobo wrote:
         | Combining the two (well, the name and your comment) I'd love a
         | poke command that acts like tee but sends a notification when
         | the calling process ends.                 ./backup.sh | poke
         | username
         | 
         | Where username would accept a system user, phone number, email
         | address, webhook url, whatever.
        
           | koolba wrote:
           | It should be reversed:
           | 
           | poke username -- path/to/command arg1 arg2
           | 
           | The command would fork, execute the child, wait for the child
           | to finish, then send out its notification.
           | 
           | This would also allow flags like:
           | 
           | poke --on-failure @koolba -- path/to/foo
           | 
           | Or even handling the child taking too long:
           | 
           | poke --on-lagging 20m @koolba -- path/to/something-that-
           | might-hang
        
           | jolmg wrote:
           | Is the point of the pipe that the notification should include
           | the output of the command like the following?
           | ./backup.sh | ( notify-send "$(cat)" )
           | 
           | though that could also be written:                 notify-
           | send "$(./backup.sh)"
           | 
           | If you also want the output in the terminal, you could use
           | tee:                 ./backup.sh | tee >(notify-send
           | "$(cat)")
           | 
           | If you want it to be an email or SMS, there are probably
           | commands that you could replace notify-send with.
        
             | corobo wrote:
             | Not really sure with pipe. It could probably just be &&'d
             | with an optional message parameter to be fair.
             | 
             | Or sprinkle some AI on it and decide based on the
             | destination. I wouldn't want a huge log being sent via sms
             | but nbd for email.
        
               | jolmg wrote:
               | > Or sprinkle some AI on it and decide based on the
               | destination.
               | 
               | Or avoid that overcomplication and specify what you want.
               | As the one writing the command, you should know if the
               | output is big and what the ideal is for the destination
               | you want.
        
               | wizzwizz4 wrote:
               | Have it specified in a config file, and provide presets
               | for common configurations (e.g. last line and exit code
               | in SMS but full log in email).
        
               | corobo wrote:
               | You don't have to make it for me haha. This is not a
               | product specification and I am not a demanding customer.
               | It's a hypothetical command that popped into my head
               | while browsing a site with hacker in the name.
               | 
               | It's also a command I could throw together in about an
               | hour with a bit of bash if I really wanted it. Mix in a
               | bit of curl, bit of whatever the sendmail command is
               | these days, bit of Twilio. Job's a good'un.
               | 
               | For the record "sprinkle some AI on it" is if statements,
               | it was a yoke.
        
           | wiml wrote:
           | It's not exactly what you describe, but you might find some
           | use in the pv (pipe viewer) command:
           | http://www.ivarch.com/programs/pv.shtml
        
         | pwdisswordfish0 wrote:
         | Please, folks, stop posting these "I thought this was going to
         | be about X" comments.
        
           | Hackbraten wrote:
           | I'm never going to understand why HN frowns upon humor so
           | much.
        
             | dkjaudyeqooe wrote:
             | Me neither. I think the trick is to make it really, really
             | dry and deadpan, then the humourless don't even notice and
             | others have can have a little chuckle.
        
             | vorpalhex wrote:
             | It's offtopic.
        
       | begoon wrote:
       | It reminded my radare2 when it had just started.
        
         | colejohnson66 wrote:
         | It reminds _me_ of 010 Editor. A programming language to
         | describe structures is exactly what 010 Editor had (they were
         | called "Binary Templates"). It allowed awesome things like:
         | this next sequence of bytes is interpreted differently
         | depending on the previously encountered bytes. For example,
         | here's the EXE file format:
         | https://www.sweetscape.com/010editor/repository/files/EXE.bt
        
       | ajarmst wrote:
       | Gnu has released an editor without including an associated emacs
       | mode? I'm sorry, that's just not acceptable.
        
         | pjscott wrote:
         | Did you check? poke-mode.el is part of their source repo:
         | 
         | https://git.savannah.gnu.org/cgit/poke.git/tree/etc/poke-mod...
        
         | swiley wrote:
         | Also no guile scripting.
        
       | chungy wrote:
       | Is this named after the old BASIC command "poke" on micros of the
       | 80s?
       | 
       | This program looks pretty awesome and seems to fit into a use-
       | case that I frequently want. I've usually just consigned myself
       | to using standard hex editors, sometimes little bits of Python to
       | wrangle whatever data I'm trying to manage.
        
         | nocman wrote:
         | That was the first thing that came to mind for me.
         | 
         | Shouldn't it also have a companion utility named peek?
         | 
         | :-D
        
       | Aissen wrote:
       | GNU poke is already really promising. You can have a look at this
       | presentation from Kernel Recipes 2019 to get a rough idea of what
       | it looked like ~two years ago:
       | 
       | https://www.youtube.com/watch?v=92Sykut06N8
       | 
       | Think of it as the missing tool between an hex editor and a
       | programming language. Hachoir, Kaitai, linker scripts or most
       | reverse engineering toolkits (radare, etc.) all try to address a
       | similar problem, but from a different angle.
        
       ___________________________________________________________________
       (page generated 2021-02-26 23:01 UTC)