• by juaniux on 4/15/2020, 9:07:08 PM

    Check out this page, it has solutions depending on your OS: https://gist.github.com/ethack/110f7f46272447828352768e6cd1c...

  • by serf on 4/15/2020, 11:02:35 PM

    i've used AutoHotkey for this in the past.

    Here's a relevant forum link.[0]

    I think ahk is mac compatible, but I haven't tried it.

    I had a similar problem in college, to which I made a bash script that called cow-say over and over again to make the cow look as if it were typing, and then recorded that section of the screen.

    Clunky but effective.

    Good luck.

    [0]: https://www.autohotkey.com/boards/viewtopic.php?t=26761

  • by slipwalker on 4/16/2020, 7:02:04 PM

    try this: onde you have the entire code ready, working properly, go to the end of the file and "backspace" your entire file clean. Now, from the top of the empty file, repeat "Ctrl-Z" until you have your code restored.

    of course, it will not work with too large files... you will be limited to the number of undos of your editor.

    ( i used to do this on "live coding" sessions )

  • by Jugurtha on 4/16/2020, 3:21:04 PM

    It may not be useful in this case, but if you're doing command line operations you can use asciinema[0] to generate your screencast as a textfile and edit the typos at specific timestamps when you're done.

    Example:

    Suppose you wanted to type `sudo su` but typed `suod su` then corrected it. Here's part of the file that would be generated:

      [1.886896, "o", "s"]
      [1.984919, "o", "u"]
      [2.047353, "o", "o"]
      [2.150955, "o", "d"]
      [2.54311, "o", " "]
      [2.629135, "o", "s"]
      [2.745892, "o", "u"]
      [3.324734, "o", "\b\u001b[K"]
      [3.481178, "o", "\b\u001b[K"]
      [3.611576, "o", "\b\u001b[K"]
      [3.776223, "o", "\b\u001b[K"]
      [3.896898, "o", "\b\u001b[K"]
      [4.089885, "o", "\b\u001b[K"]
      [5.812011, "o", "u"]
      [5.978867, "o", "d"]
      [6.017407, "o", "o"]
      [6.177912, "o", " "]
      [6.385136, "o", "s"]
      [6.385614, "o", "u"]
    
    
    You can edit the file, delete the type and correction-delete keys and keep the right one. Yan even edit the timestamp if you want to either with your text editor with macros, or a spreadsheet once you're done and decrement by four seconds.

    When you play it with `asciinema play foobar.cast`, it will play `sudo su`.

    Quick tip:

      asciinema rec -i 2 deployment_screen.cast
    
    The above records the "screen" to a `deployment_screen.cast` file, and reduces all idle time longer than two seconds to two seconds. If you type a character, then pause for an hour, then type another character, the cast will reduce that dead "half hour" to two seconds. Super useful.

    I use that when I'm deploying something for the first time and may have to install additional dependencies or edit some config files and haven't yet scripted the thing. I record the deployment cast and dispatch it, then put it in the target machine and add a `cat /home/user/README.md` in `.bashrc`. The README.md file explains what the target machine is about, the services that are deployed, and where the cast file is.

    After all the rough edges are rounded, you can go over the cast file and encode the steps in a Dockerfile or whatever thing you're using and not miss a dependency.

    [0]: https://asciinema.org/