cfedde's Journal cfedde'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-02-09T09:30:24+00:00 pudge Technology hourly 1 1970-01-01T00:00+00:00 cfedde's Journal Tricks for .profile <tt># Add manual directories to to your MANPATH environment<br>MANPATH=$MANPATH:`perl -le 'print join ":",grep{s/bin$/man/&amp;&amp;-d} split<nobr> <wbr></nobr>/:/,$ENV{PATH}'`<br><br>#<br># uniqify PATH and MANPATH<br>#<br>PATH=`perl -le 'print join(":", grep {! $t{$_}++} split(/:/,$ENV{PATH}))'`<br>MANPATH=`perl -le 'print join(":", grep {! $t{$_}++} split(/:/,$ENV{MANPATH}))'`<br></tt> cfedde 2009-07-08T02:30:22+00:00 journal A couple shell functions <tt>google () {<br>&nbsp; &nbsp; u=`perl -MURI::Escape -wle 'print "".<br>&nbsp; &nbsp; uri_escape(join " ",&nbsp; @ARGV)' $@`<br>&nbsp; &nbsp; w3m -no-mouse -F $u<br>}<br><br>scpan () {<br>&nbsp; &nbsp; u=`perl -MURI::Escape -wle 'print "".<br>&nbsp; &nbsp; &nbsp; &nbsp; uri_escape(join " ",&nbsp; @ARGV)<nobr> <wbr></nobr>."&amp;mode=module&amp;n=100"' $@`<br><br>&nbsp; &nbsp; w3m -no-mouse -F $u<br>}<br></tt> cfedde 2009-07-02T19:02:45+00:00 journal Generate a list of candidate DNS domains <tt>wget &amp;&amp;<br>perl -MIO::All -le '<br>my @x;<br>BEGIN{@x = io("/usr/share/dict/words")-&gt;chomp-&gt;slurp}<br>while (&lt;&gt;) {<br>&nbsp; &nbsp;<nobr> <wbr></nobr>/title="\.([^"\s+]+)/ or next;<br>&nbsp; &nbsp; $re = qr/${1}$/;<br>&nbsp; &nbsp; print for (grep {s/($re)/.$1/} @x)<br>}<br>' List_of_Internet_top-level_domains<br></tt> cfedde 2009-07-01T15:42:33+00:00 journal