Perl Obfuscated code for fun 

Today, I played the original came code which print camel picture. http://perlmonks.org/?node=camel+code

I just quckly turned the program shape into a chinese character zhong, and obviously it will print out chinese character zhong :)

Check the code http://bl0g.blogdns.com/code2006/zhong.pl
[ add comment ] permalink ( 3 / 95 )
Perl buffer suffering 

Wonder what $| =1 in Perl means? here is a great link to learn Perl buffering

http://perl.plover.com/FAQs/Buffering.html
[ add comment ] permalink ( 3 / 105 )
Debugging SpamAssassin with timestamp 

I just learned from amavisd-new developer Mark I could run command below to check the timestamp of each SA running debugging lines:

su clamav -c 'spamassassin -t -D <test.msg' 2>&1 | perl -MPOSIX -MTime::HiRes -n -e '
BEGIN {$|=1; $dp=0; $t0=Time::HiRes::time};
$t=Time::HiRes::time; $dt=$t-$t0; printf("%s%06.3f %4.3f %4.3f %s",
POSIX::strftime("%H:%M:",localtime($t)), $t-int($t/60)*60,
$dt, $dt-$dp, $_); $dp=$dt' $*


[ add comment ] permalink ( 3.2 / 85 )
Perl one-liner to split mbox 

perl -pe 'BEGIN { $n=1 } open STDOUT, ">$ARGV.$n" and $n++ if /^From /' MailBox

which will split mbox format file MailBox to single email file. there is more one-liner from http://sial.org/howto/perl/one-liner/
[ add comment ] permalink ( 2.9 / 73 )
Running OS X and Windows on Mac Intel 

Just got an Macbook to test run OS X and Windows XP SP2. There is tip which may help other users to install Windows:

1. Boot into Mac OS X.
2. In BootCamp Assistant, remove the Windows partition.
3. Reboot per request.
4. In BootCamp Assistant, repartition for Windows.
5. Reboot into XP Installer.

Always try above if somethings go wrong
[ add comment ] permalink ( 3.1 / 69 )

Back Next