Last Updated: March 17, 2016
· tadas_t
Img 4302

Learn facts while pulling code changes

What if I told you, that pulling code from a git repo could boost your knowledge?

I've been doing this for a month now, and as a side effect of pulling code changes I now know who in the world drank the most beer, how the microwave was invented, and how much does the highest paid CEO get a day. Here's how to do it: create an alias or a function for a random fact

alias fact="elinks -dump randomfunfacts.com | sed -n '/^| /p' | tr -d \|"

and hook it up to whatever you use for pulling your code (you don't type git pull every time, do you?).

alias glr='fact && git pull --rebase'

Put those to your .bashrc or .zshrc and learn a new thing every time you pull!


Edit1: discussion on Hacker News

Edit2: If you use OSX and don't have elinks, the easiest way to install it is via homebrew

brew install elinks
Say Thanks

4 Responses
Add your response


fun idea!

over 1 year ago ·

Nice idea, the alias could be simplified however:

alias fact="elinks -dump randomfunfacts.com | grep '^|' | tr -d \|"

over 1 year ago ·

While you can build ELinks on cygwin, it's kind of a pain. I found this works, and gives the rectangle around the fact, if you want it:

links -dump randomfunfacts.com | grep "+\||"

over 1 year ago ·

I cooked up this quick workaround for cases where elinks aren't available:

alias fact="wget -q -O - randomfunfacts.com | grep '<strong><i>' | sed 's/<[^>]\+>//g' | sed 's/&nbsp;//g' | sed 's/^[ ]*//g'"
over 1 year ago ·
Filed Under