View the newest xkcd comic.

This function displays the latest comic from xkcd.com. One of the best things about xkcd is the title text when you hover over the comic, so this function also displays that after you close the comic.

$ xkcd(){ local f=$(curl -s http://xkcd.com/);display $(echo \"$f\"|grep -Po \'(?<=\")http://imgs.xkcd.com/comics/[^\"]+(png|jpg)\');echo \"$f\"|awk \'/<img src=\"http://imgs.xkcd.com/comics/.*?\" title=.*/{gsub(/^.*title=.|\".*?$/,\"\");print}\';}

To get a random xkcd comic, I also use the following:

xkcdrandom(){ local f=$(wget -q http://dynamic.xkcd.com/comic/random/ -O -);display $(echo \"$f\"|grep -Po \'(?<=\")http://imgs.xkcd.com/comics/[^\"]+(png|jpg)\');echo \"$f\"|awk \'/<img src=\"http://imgs.xkcd.com/comics/.*?\" title=.*/{gsub(/^.*title=.|\".*?$/,\"\");print}\';}

\"\"

by David Winterbottom (codeinthehole.com)

\"\"
\"\"

\"\"

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/JtqAcfWoFMA/view-the-newest-xkcd-comic.

Insert a comment on command line for reminder

Bookmark this category
Insert a comment on command line for reminder

$ ls -alh #mycomment

Comments can be used directly on the command line so I can save in the history a brief description of what command does.

* View this command to comment, vote or add to favourites * View all commands by vgagliardi

commandlinefu.com

by David Winterbottom (codeinthehole.com)

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/_5hXsFUuAwc/insert-a-comment-on-command-line-for-reminder

bash colors

\"People
Image via Wikipedia

For those of the terminal freaks, color is a bliss. But have you tried all the colors in the terminal. Today someone forwarded me a bash one liner for the same. Not sure where he got this from, anyway here is the one liner for you all:

for c in `seq 0 255`;do t=5;[[ $c -lt 108 ]]&&t=0;for i in `seq $t 5`;do echo -e \”e[0;48;$i;${c}m|| $i:$c `seq -s+0 $(($COLUMNS/2))|tr -d \'[0-9]\’`e[0m\”;done;done

\"Reblog