You are not logged in.
Pages: 1
Another gem from commandlinefu.com, via this page. Add this line to your .bash_aliases:
wiki() { dig +short txt $1.wp.dg.cx; } and type 'wiki keyword' to get a quick paragraph from wikipedia in your terminal. 
(I had 'dig' already installed on #!9.04, I haven't checked for Statler.)
edit This version lets you input multiple-word phrases without having to put them in quotes:
wiki() { dig +short txt "$*".wp.dg.cx; }Last edited by johnraff (2010-06-04 18:12:21)
John
--------------------
( a boring Japan blog , and idle twitterings )
Offline
Nice tip, thank you for sharing. 
Offline
ah comandlinefu
i use a slightly improved version
function wiki() #check wikipedia
{ dig +short txt "${@}".wp.dg.cx | awk 'BEGIN{RS="\" \"";ORS=""} // {gsub("\"",""); sub("htt","\nhtt"); print}';}gets rid of the quotes etc.
also theres:
function cmdfu() #get stuff from cammandline fu
{ wget -O - "http://www.commandlinefu.com/commands/matching/$@/$(echo -n "$@" | openssl base64)/plaintext";}- - - - - - - - Wiki Pages - - - - - - -
#! install guide *autostart programs, modify the menu & keybindings
configuring Conky *installing scripts
Offline
ah comandlinefu
Fun!
i use a slightly improved version
function wiki() #check wikipedia { dig +short txt "${@}".wp.dg.cx | awk 'BEGIN{RS="\" \"";ORS=""} // {gsub("\"",""); sub("htt","\nhtt"); print}';}gets rid of the quotes etc.
added that stuff at the end to my personal version and it does take out the quotes. Couldn't see any other difference though.
btw, for multi-word query phrases I think that "${@}" could perhaps better be a "$*" in this case?
Another recent discovery, to translate from any language to English, or other target language, with the 2-letter language code:
translate(){ wget -qO- "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=%7C${2:-en}" | sed 's/.*{"translatedText":"\([^"]*\)".*/\1\n/'; }eg
translate 'chien noir' ja
returns
黒い犬
-not my own work, though...
John
--------------------
( a boring Japan blog , and idle twitterings )
Offline
function cmdfu() #get stuff from cammandline fu { wget -O - "http://www.commandlinefu.com/commands/matching/$@/$(echo -n "$@" | openssl base64)/plaintext";}
I had been using a version with curl instead of 'wget -O -' but it wouldn't take multi-word searches for some reason. Yours works though
Try
wget -qO - to get rid of wget's commentary.
Last edited by johnraff (2010-06-05 16:53:18)
John
--------------------
( a boring Japan blog , and idle twitterings )
Offline
Try
wget -qO -to get rid of wget's commentary.
good tip.
I'm guessing i used "${@}" , so i could do 'wiki foo,bar' and get pages for foo and bar, it doesn't work so i probably just left it.
- - - - - - - - Wiki Pages - - - - - - -
#! install guide *autostart programs, modify the menu & keybindings
configuring Conky *installing scripts
Offline
Pages: 1
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.