metalcrowe's Journal metalcrowe's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:37:57+00:00 pudge Technology hourly 1 1970-01-01T00:00+00:00 metalcrowe's Journal A new verb for refactoring? <p>It occured to me (during a random AIM conversation with a friend) that you could take the two terms SPOT and DRY and combine them into a new term that is easily <a href="">verbed</a>. So then you could say things like "I'm <em>spot drying</em> this module to help stamp out bugs."</p> metalcrowe 2006-07-17T08:38:41+00:00 journal A couple one-liners <p>These are probably stupid-simple-obvious, but I find them useful enough that they made it into little scripts in <tt>~/bin</tt>.</p><dl> <dt> <tt>unique</tt> </dt><dd> <p> <code>perl -ne'print unless $lines{$_}++'</code> </p><p>Only print the first occurance of a line. This one came about recently when I wanted to find out which of my ripped albums were 128kbps mp3s (so I could re-rip them!):</p><p> <code>mp3find ~/cds -bitrate 128 -printf '%b' | unique</code> </p></dd><dt> <tt>qm</tt> </dt><dd> <p> <code>perl -pe'chomp;$_=quotemeta($_)."\n"'</code> </p><p>This one comes in handy when using <tt>xargs</tt> to pipe a bunch of mp3 filenames with spaces in them to something like <tt>madplay</tt> or <a href="">BMP</a>.</p></dd><dt> <tt>nocomment</tt> </dt><dd> <p> <code>perl -pe's/(^|\s)#.*//;'</code> </p><p>Dumb comment stripper. Again useful for piping M3U lists to <tt>madplay</tt>:</p><p> <code>nocomment ilyaimy.m3u | qm | xargs madplay</code> </p></dd></dl> metalcrowe 2006-01-30T08:37:30+00:00 journal Sharing resume/cv/etc. information <p>I had similar thoughts about <a href="">information sharing</a> last fall when I was filling out grad school applications. All the forms were online, but I had to type in the same information (contact, academic history, etc, etc) on six slightly different web forms. And, maddeningly, even for the schools that had their application forms hosted by the same third party, there was no way to share my information between the different forms!</p><p>The first thing I thought of was "there should be a central clearinghouse of some sort, where I could fill out this once and have it shared between whatever schools I specify." But then (in a more free software inspired moment) I realized there already <em>was</em> a clearinghouse for all this information: me. Why shouldn't I be able to collect all this information into some standard (dare I say XML?) file format, post said file on the web, and then just hand people the URL when they needed that info.</p><p>There is <a href="">XML R&eacute;sum&eacute;</a>. I had a look, and it looks simple enough. But as schwern <a href=";cid=39645">pointed out</a>, where's the Perl library<nobr> <wbr></nobr>;-) And the other (more pressing) question is, is anyone using this as an exchange format?</p> metalcrowe 2005-04-13T14:30:24+00:00 journal