Subdomain Posts
Perl | 944 days ago
Perl | 944 days ago
CSS | 949 days ago
Recent Posts
None | 16 sec ago
None | 59 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Plutor on the 19th of Aug 2007 10:06:19 PM Download | Raw | Embed | Report
  1. #!/usr/bin/perl
  2.  
  3. # How I used this:
  4. # I saved all of the MetaTalk archives linked from <http://metatalk.metafilter.com/archive.mefi>
  5. # Then, I ran this script with all of the filenames as arguments.
  6. # I posted the results here: <http://metatalk.metafilter.com/14744/Safety-first#444331>
  7.  
  8. use POSIX qw(strftime);
  9.  
  10. my %mval = (    January     => 0,
  11.                 February    => 1,
  12.                 March       => 2,
  13.                 April       => 3,
  14.                 May         => 4,
  15.                 June        => 5,
  16.                 July        => 6,
  17.                 August      => 7,
  18.                 September   => 8,
  19.                 October     => 9,
  20.                 November    => 10,
  21.                 December    => 11 );
  22.  
  23. my @posts;
  24.  
  25. for my $filename (@ARGV) {
  26.     if (open(F, "<", $filename)) {
  27.         local $/;
  28.         my $f = <F>;
  29.         close(F);
  30.  
  31.         my ($month, $year) = ($f =~ /<p class="copy">(\w+) (200\d) Archives \(<a href="\/archive\.mefi">all archives<\/a>\)<\/p>/);
  32.         $year -= 1900;
  33.  
  34.         my ($day, $hour, $min);
  35.         while ($f =~ /<div class="monthday">(\w+) (\d+)<\/div>|<span class="smallcopy">posted by <a[^>]*>[^<]*<\/a> to <a[^>]*>[^<]*<\/a> at (\d+):(\d+) ([AP]M) PST - <a href="([^"]*)"/g) {
  36.             if ($1 and $2) {
  37.                 $day = $2;
  38.             } elsif ($3 and $4 and $5) {
  39.                 $hour = $3;
  40.                 $min = $4;
  41.                 $hour = 0 if ($hour == 12);
  42.                 $hour += 12 if ($5 eq "PM");
  43.  
  44.                 $url = $6;
  45.                 ($name) = ($url =~ /\/mefi\/(\d+)/);
  46.  
  47.                 my $u = strftime('%s', 0, $min, $hour, $day, $mval{$month}, $year);
  48.                 push @posts, [ $u, $url, $name ];
  49.             }
  50.         }
  51.     } else {
  52.         warn "Could not open $filename: $!";
  53.     }
  54. }
  55.  
  56. @posts = sort { $b->[0] <=> $a->[0] } @posts;
  57. my $lastpost = shift @posts;
  58.  
  59. for my $p (@posts) {
  60.     my $diff = abs( $lastpost->[0] - $p->[0] );
  61.     if ($diff >= 24*60*60) {
  62.         print "<a href=\"$lastpost->[1]\">$lastpost->[2]</a> ";
  63.         print "and <a href=\"$p->[1]\">$p->[2]</a> - ";
  64.         printf('%d:%02d', int($diff/3600), int($diff/60)%60);
  65.         print " apart on " . strftime('%d %b %Y', localtime($p->[0])) . "\n";
  66.     }
  67.  
  68.     $lastpost = $p;
  69. }
Submit a correction or amendment below. [ previous version ] | [ difference ] | Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: