termtosvg (GitHub repo) is a handy little tool that makes recording animated sessions in the terminal as simple as humanly possible. Instead of generating heavy graphics or video animations, this tool creates SVG files, which are a lot smaller and easier. There is also a selection of themes to choose from.
Th resulting SVG files can be used as quick demos and guides in READMEs on GitHub, or as tutorials for your application’s website.
More and more often I come across a scenario where I need to repeat the shell command until it succeeds. Here are a couple of examples:
Reboot a server. Try to remotely login to it via ssh. This fails until the server actually boots up. Keep trying until connected.
Start an application that writes to the log file. Run “tail -f some.log” to watch the log messages. This fails if the log file does not exist yet. Keep trying until the application creates the log file and writes something into it.
Sure, I can always press the up arrow key and Enter, to repeat the last command from the history. But it is a tiny bit annoying.
Today I came across this little trick, that solves the problem. Add the following function to your .bashrc:
CMD=$(fc -ln | tail -n 2 | head -n 1)
echo "repeating until success: $CMD"
Now you can run “rpt” to repeat the latest command until it succeeds.