Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

cfedde (8355)

cfedde
  (email not shown publicly)

Journal of cfedde (8355)

Tuesday July 07, 2009
09:30 PM

Tricks for .profile

# Add manual directories to to your MANPATH environment
MANPATH=$MANPATH:`perl -le 'print join ":",grep{s/bin$/man/&&-d} split /:/,$ENV{PATH}'`

#
# uniqify PATH and MANPATH
#
PATH=`perl -le 'print join(":", grep {! $t{$_}++} split(/:/,$ENV{PATH}))'`
MANPATH=`perl -le 'print join(":", grep {! $t{$_}++} split(/:/,$ENV{MANPATH}))'`
Thursday July 02, 2009
02:02 PM

A couple shell functions

google () {
    u=`perl -MURI::Escape -wle 'print "http://google.com/search?q=".
    uri_escape(join " ",  @ARGV)' $@`
    w3m -no-mouse -F $u
}

scpan () {
    u=`perl -MURI::Escape -wle 'print "http://search.cpan.org/search?query=".
        uri_escape(join " ",  @ARGV) ."&mode=module&n=100"' $@`

    w3m -no-mouse -F $u
}
Wednesday July 01, 2009
10:42 AM

Generate a list of candidate DNS domains

wget http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains &&
perl -MIO::All -le '
my @x;
BEGIN{@x = io("/usr/share/dict/words")->chomp->slurp}
while (<>) {
    /title="\.([^"\s+]+)/ or next;
    $re = qr/${1}$/;
    print for (grep {s/($re)/.$1/} @x)
}
' List_of_Internet_top-level_domains