Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Fortune? Bah' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fortune? Bah
Authored by: Shiver758 on Sep 17, '04 10:27:12PM
How very 1988.

How about something a bit more fun (not to mention up-to-date)?

I discovered my new favorite site this week, and it immediately sprang to mind when I read this. Fortune is just so.. tired.

Firstly, check out http://www.thesimpsonsquotes.com. Then, check out http://www.thesimpsonsquotes.com/add_random_quotes.html. After checking that the code provided on the site offers you a handy GET var to change the number of quotes that come back, my mind immediately started cranking.. So, I used a bit of curl/perl to create myself a random password generator for my Samba PDC.. But, I digress. Using a bit of that perl code, I've modded this hint to make it do random SIMPSONS quotes, instead of used up old bloody Fortune quotes. Be the first kid on your block to have random Simpsons .sigs!!

First, the perl:

#!/usr/bin/perl
open (PIPE, "curl http://www.thesimpsonsquotes.com/random.php?num=1 2> /dev/null |");
@myData = <PIPE>;
close(PIPE);

foreach $line (@myData) {
  if($line =~ s/^<p>//g) {
    $line =~ s/....$//g;
    if(!@ARGV[0] || @ARGV[0] != '--with-name') {
      $line =~ s/[^:]+://g;
    }
    chomp $line;
    print "---\n";
    print $line."\n";
    exit 0;
  }
}
Save this as /Users/username/bin/simpson_quote.pl

Back out to the shell and run
 chmod +x ~/bin/simpson_quote.pl 
(make the perl script an executable).

Then, follow the normal instructions from the hint (and the comments, if you like, a big thank you to the person who submitted the ___m thing.. badass!). Just substitute
 <path to fortune> 
with
 /Users/<username>/bin/simpson_quote.pl --with-name 
(the --with-name bit is optional.. it just leaves in the starting bit with Character Name: rather than leaving it off)

I just set it up myself, and hopefully I've actually written the instructions correctly.. I'll check back here for questions, comments.

Have fun! And remember...

---
Milhouse: Why do you have a social worker? I am the one with stigmata.

PS - Cheers to the original author. Handy little AScript. ;)

[ Reply to This | # ]
Fortune? Bah (oops!)
Authored by: Shiver758 on Sep 18, '04 12:05:17AM

BTW, I found a little problem. Some of the quotes have a trailing "<br>". So, to protect from this I changed line 12 to read:

$line =~ s/<br//g;

I had it in the full version, just didn't copy it over into the snippet I put on here.

Have fun!



[ Reply to This | # ]