Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

post bits of code you like

Name: Anonymous 2005-08-02 1:52

i shall start:

open(F,"find -type f|");
while (<F>) {
 $_ = substr($_,2,-1);
 print "$_\n" if $v;
 push @{$dups{substr(`md5sum -b "$_"`,0,31)}}, $_;
}
close(F);

for every file in a directory it checksums the file, then adds the checksum as a key to a hash, the value being an array reference. the filename is then added to the array.

so basically the arrays have a list of files with the same checksum. i use this to find duplicates files.

Name: Anonymous 2005-11-09 20:01

>>39
That's what I call witty programming. If Python source is as structured as it seems, and everything sounds to be so clean, yet it's still powerful enough to do that, then you've given me another reason to learn Python.

And the differente with Perl would be that, while you can be obfuscated in both, Perl's syntax is crappy even when you do not intend to obfuscate your code, and most Perl code I saw was a nightmare.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List