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.
To get a random xkcd comic, I also use the following:
xkcdrandom(){ wget -qO- dynamic.xkcd.com/comic/random|tee >(feh $(grep -Po '(?<=")http://imgs[^/]+/comics/[^"]+\.\w{3}'))|grep -Po '(?<=(\w{3})" title=").*(?=" alt)';}
4 random words are better than one obfuscated word http://xkcd.com/936/ Show Sample Output
i sorta stole this from http://www.shell-fu.org/lister.php?id=878#MTC_form but it didn't work, so here it is, fixed. --- updated to work with jpegs, and to use a fancy positive look behind assertion.
Saves to a PDF with title and alt text of comic. As asked for on http://bbs.archlinux.org/viewtopic.php?id=91100 Change xkcd.com to dynamic.xkcd.com/comics/random for a random comic.
The improvement of this command over Strawp's original alternative is that you can specify the size of the words, in this particular case words between 3 and 5 character's long. It also excludes words that contain apostrophes, if you'd rather keep those words simply substitue [^'] for . Show Sample Output
This is what I came up to generate XKCD #936 style four-word password. Since first letter of every word is capitalized it looks a bit more readable to my eyes. Also strips single quotes. And yes - regex is a bit of a kludge, but that's the bes i could think of. Show Sample Output
Some snippets posted are slow on big dictionaries, this one is fast. Show Sample Output
This restricts things 3 ways: 1. No capitalized words, hence no proper names. 2. No apostrophes. 3. Restricts size to range (3,7) Show Sample Output
I wasn't sure how to display the image, so I thought I'd try xml for a different twist. Show Sample Output
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.
To get a random xkcd comic use the following:
xkcdrandom() { wget -qO- http://dynamic.xkcd.com/comic/random | sed -n 's#^<img src="\(http://imgs.[^"]\+\)"\s\+title="\(.\+\?\)"\salt.\+$#eog "\1"\necho '"'\2'#p" | bash; }
These are just a bit shorter than the ones eigthmillion wrote, however his version didn't work as expected on my laptop for some reason (I got the title-tag first), so these build a command which is executed by bash.
So I use OSX and don't have the shuf command. This is what I could come up with. This command assumes /usr/share/dict/words does not surpass 137,817,948 lines and line selection is NOT uniformly random. Show Sample Output
This does the same thing that the command 'j_melis' submitted, but does it a lot quicker. That command takes 43 seconds to complete on my system, while the command I submitted takes 6 seconds. Show Sample Output
Before running, do: curl -sO http://world.std.com/%7Ereinhold/diceware.wordlist.asc Show Sample Output
Took one of the samples, added capitalization and removes in between spaces. The final "echo" is just for readability. Cheers Show Sample Output
Get http://xkcd.com/now image, inverts colors (I prefer dark backgrounds) and set it as wallpaper. You can replace the "convert" part by "wget -q http://imgs.xkcd.com/comics/now.png -O /tmp/now.png" if you prefer light backgrounds. The DISPLAY variable is here to work as a cron job. Show Sample Output
Same thing just a different way to get there. You will need lynx
Will create a graph of the results for "x bottles of beer on the wall". Requires Gnuplot. Inspired by an xkcd comic: http://xkcd.com/715/ For sample output see: http://tr.im/xbottlesofbeer Show Sample Output
Output the html from xkcd's index.html, filter out the html tags, and then view it in gwenview. Show Sample Output
Shorter version with curl and awk
Just added view with the eog viewer.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: