Last active
November 11, 2018 06:09
-
-
Save xbalaji/84e5752a03c4f11b5cbedadb30819120 to your computer and use it in GitHub Desktop.
scroll code for gif
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from https://superuser.com/questions/472476/is-there-an-automatically-scrolling-time-delayed-unix-pager-command | |
function scroll | |
{ | |
while read -r ; do echo "$REPLY" ; sleep ${1:-0.5} ; done | |
} | |
# assuming you have source code src directory | |
find src -type f -name "*c" -exec cat {} \; | scroll 0.2 | |
# use the following vimpager, asciinema, asciicast2gif | |
# steps | |
# 1. git clone git@github-xbalaji:xbalaji/vimpager.git ~/dev/github-xbalaji/vimpager | |
# 2. sudo -H pip3 install asciinema | |
# 3. docker pull asciinema/asciicast2gif | |
# 4. assuming your source is in ~/dev/github-xbalaji/animation | |
# 5. cd ~/dev/github-xbalaji/animation | |
# 6. find . -type d -path "*git" -prune -o -type f -print <-- check the source files for animation | |
# 7. now add some spaces in the beginning of the line for each of the file | |
# 8. find . -type d -path "*git" -prune -o -type f -exec sed -i -e 's/^/ /' {} \; | |
# 9. also add some empty lines at the top and bottom of the each file | |
# 10. for lx in 1 2 3 .. 10; do find . -type d -path "*git" -prune -o -type f -exec sed -i '1s/^/ \n/' {} \; ; done | |
# 11. also to end of the file | |
# 12. for lx in 1 2 3 .. 10; do find . -type d -path "*git" -prune -o -type f -exec sed -i -e "\$a\ " {} \; ; done | |
# 13. start the asciinema | |
# 14. asciinema rec ~/xb-banner.cast -q -t 'xbalaji banner' -c 'find . -type d -path "*git" -prune -o -type f -exec ~/dev/github-xbalaji/vimpager/vimcat -t 0.5 {} \;' | |
# 15. mv ~/xb-banner.cast ./xb-banner.cast | |
# 16. convert to gif using asciicast2gif | |
# 17. docker run --rm -v $PWD:/data asciinema/asciicast2gif ./xb-banner.cast ./xb-banner.gif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment