display http://dilbert.com$(curl -s dilbert.com|grep -Po '"\K/dyn/str_strip(/0+){4}/.*strip.[^\.]*\.gif')

Display Dilbert strip of the day

Requires display. Corrected version thanks to sputnick and eightmillion user.

By: wizel
2009-12-05 19:35:27

These Might Interest You

  • This form is used in patches, svn, git etc. And I've created an alias for it: alias diff='diff -Naur --strip-trailing-cr' The latter option is especially useful, when somebody in team works in Windows; could be also used in commands like svn diff --diff-cmd 'diff --strip-trailing-cr'... Show Sample Output

    diff -Naur --strip-trailing-cr
    ruslan · 2011-02-10 14:32:42 0
  • If you want to decompress the files from an archive to current directory by stripping all directory paths, use --transform option to strip path information. Unfortunately, --strip-components option is good if the target files have same and constant depth of folders. The idea was taken from http://www.unix.com/solaris/145941-how-extract-files-tar-file-without-creating-directories.html Show Sample Output

    tar --transform 's#.*/\([^/]*\)$#\1#' -xzvf test-archive.tar.gz
    alperyilmaz · 2010-11-29 23:16:57 1
  • If archive has leading directory level same as archive name and you want to strip it, this command is for you.

    tar -xaf archive.tar.gz --strip-components=1
    sirex · 2011-11-29 07:38:19 0
  • If you have multiple displays or monitors the DISPLAY environment variable will tell X where to send the output. This is very handy for setting up a mediacenter at home. You can plugin the computer to the TV and then ssh to the computer and set the DISPLAY as above, then run your program and it will show up on the TV.

    DISPLAY=:0.0; export DISPLAY
    sb · 2009-11-23 14:28:39 0
  • Strip my code to: wmctrl -o 0,0 # autorotates to the first face. In fact [0-1279],0 wmctrl - 1280,0 # goes to the second face wmctrl -o 2560,0 # goes to the third face, and so on. # Use multiples of the horizontal display resolution. My example work for 1280x800 display, been 1280 the number of interest. Tweak the number, try a biiiig one and see your cube spinning... I put a complex example to show how fun things can be, even for my ademco and paradox alarm central network advisor interface xpto etc. It rotates two faces, print the alarm message, and goes back tho where it was. Tested on BIGLINUX 4.2, equivalent to ubuntu LTS hardy. Do not forget to activate 3D efects ( compiz cube ) Show Sample Output

    wmctrl -o 2560,0 ;sleep 2 ; echo "FIRE 001" | osd_cat -o 470 -s 8 -c red -d 10 -f -*-bitstream\ vera\ sans-*-*-*--250-*-*-*-*-*-*-* ; sleep 1; wmctrl -o 0,0
    m33600 · 2009-10-23 10:00:51 0
  • Bulk downloads the comic strip JPG files for the adult cartoon Savitabhabhi, storing each set in it's own folder. Requires manual removal of "non-image" files that maybe created because each series may differ in length. The command can be easily adapted for UNIX flavours. You need to have cURL in your path.

    for /L %%x in (1,1,16) do mkdir %%x & curl -R -e http://www.kirtu.com -o %%x/#1.jpg http://www.kirtu.com/toon/content/sb%x/english/sb%x_en_[001-070].jpg
    MyTechieself · 2009-12-08 15:01:16 0

What Others Think

Hi. Nice one. Can you explain the start of the perl regexp ? : (?<=") And at the end, the ( ) are not needed IMHO. Cheers, sputnick.
sputnick · 441 weeks and 4 days ago
Hi Sputnik, that's a positive lookbehind assertion. The regex only matches "/dyn/str_..." if it's preceded by a double quote character. By the way, wizel, that regex can be made shorter. This is what I would use: display http://dilbert.com$(curl -s dilbert.com|grep -Po '(?<=")/dyn/str_strip(/0+){4}/.*strip.gif')
eightmillion · 441 weeks and 4 days ago
thanks sightmillion, your're right. I was wondering what the Dilber site used to tag/identify the strip. So I opted for the "safest" approach, but thing your proposal works OK.
wizel · 441 weeks and 3 days ago
Thanks eightmillion. The website made changes. I have successfully tested : display http://www.dilbert.com/$(curl -s dilbert.com | grep -Po '(?<=")/dyn/str_strip(/0+){4}/.*strip.[^\.]+\.gif')
sputnick · 441 weeks and 3 days ago
Another way : display http://dilbert.com$(curl -s dilbert.com|grep -Po '"\K/dyn/str_strip(/0+){4}/.*strip.[^\.]*\.gif')
sputnick · 441 weeks and 3 days ago
sputnick, I've corrected with you version and added your name in the comments. If you don't feel OK, pls let me know.
wizel · 441 weeks and 2 days ago
And for your crontab : 30 08 * * 1-5 DISPLAY=:0 display http://dilbert.com$(curl -s dilbert.com | grep -Po '"\K/dyn/str_strip(/0+){4}/.*strip.[^\.]*\.gif') Like mine, you will have monday to friday the image shown on your desktop at 08:30 AM
sputnick · 441 weeks and 1 day ago
Here's one for Doonesbury. The regex is easier for this site: display -title 'Doonesbury' $(curl -s http://www.doonesbury.com/strip/dailydose/index.html | grep -Eow -m 1 'http://images.ucomics.com/comics/db/[0-9]{4}/db[0-9]{6}\.gif') The grep -w and -m 1 options are unnecessary but I thought might make it a bit more robust.
johnraff · 440 weeks and 6 days ago
This works on OSX open $(curl -s dilbert.com | grep -o 'http://dilbert.com/dyn/.*strip.gif')
neslob · 424 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

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.

Share Your Commands

Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: