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 2012-06-27 6:58

static inline void outb(u8 v, u16 port){
    asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
}
static inline u8 inb(u16 port){
    u8 v;
    asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
    return v;
}

static inline void rep_insw(u16 port, void * dest, u64 n){
    asm volatile(
        "cld; rep insw"
        :"=D"(dest), "=c"(n)
        :"d"(port), "D"(dest), "c"(n)
    );
}


and

.global spin_lock_adquire
spin_lock_adquire:
    mov    4(%esp), %ecx
    mov    $1, %eax
1:
    xchg (%ecx), %eax
    test %eax, %eax
    jnz 1b
    ret


fucking delicious

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