hvfvva
Last Updated: March 17, 2016
·
17.17K
· 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!

Picture

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
Respond

4 Responses
Add your response

2203
Cd0ac1afd622386fcc12926a23f5848c

fun idea!

over 1 year ago ·
2303
D2e4fccafdc13139706f8d0f4db6b13a

Nice idea, the alias could be simplified however:

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

over 1 year ago ·
2339
Image

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 ·
19855
None

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