Skip to content

Instantly share code, notes, and snippets.

@cryks
Created May 14, 2012 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cryks/2691931 to your computer and use it in GitHub Desktop.
Save cryks/2691931 to your computer and use it in GitHub Desktop.
#!/usr/bin/env gosh
(use gauche.generator)
(use rfc.md5)
(define (main argv)
(let ([lis (make-hash-table 'string=?)])
(dolist [file (filter file-is-regular? (glob "md5/*.md5"))]
(do-generator [line (file->line-generator file)]
(rxmatch-case line
[#/^([^ ]+) (.*)$/ (#f md5)
(hash-table-push! lis md5 file)])))
(dolist [file (filter file-is-regular? (glob "files/**/*"))]
(let* ([md5 (digest-hexify (with-input-from-file file md5-digest))]
[lis (ref lis md5 '(" "))])
(print #`",(last (sort lis)) ,file (,(length lis))")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment