This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use common::sense; | |
sub circ { | |
my ($a, $b, $r, $h, $w) = @_; | |
for my $y (0 .. $h) { | |
for my $x (0 .. $w) { | |
my $z = (($x - $a)**2 + ($y - $b)**2) / ($r**2); | |
print(($z >= 0.9 && $z <= 1.1) ? 'X' : ' '); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://en.wikipedia.org/wiki/Sign_function | |
sub sgn { | |
return sprintf('%.0f', $_[0] / sqrt($_[0] ** 2 + 0.00001)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
perl -MExtUtils::Installed -E 'chdir $ENV{PERL_LOCAL_LIB_ROOT}; my $i = new ExtUtils::Installed; say for $i->modules' | cpanm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -MO=Concise x.pl | |
perl -MO=Deparse x.pl | |
perl -Mcommon::sense -MDevel::REPL -e 'Devel::REPL->new->run' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use common::sense; | |
use lib 'lib'; | |
use open ':locale'; | |
use lexicals; | |
use Data::Dumper; | |
use Data::Printer; | |
use Digest::MD5 qw(md5_hex md5_base64); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -MFile::Basename '-F/\t/' -ane 'if ($F[3] =~ /^(A|CNAME)$/) { my $d = $F[0] . "." . (fileparse($ARGV, ".db"))[0]; $d =~ s/^.*\.\.//; print "$d\t$F[4]" unless $F[4] =~ /\b127\.0\.0\.1\b/ }' /var/named/*.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -o vi | |
# ^p check for partial match in history | |
bind -m vi-insert "\C-p":dynamic-complete-history | |
# ^n cycle through the list of partial matches | |
bind -m vi-insert "\C-n":menu-complete | |
# ^l clear screen | |
bind -m vi-insert "\C-l":clear-screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use common::sense; | |
use Benchmark; | |
use WWW::Mechanize::Firefox; | |
my $mech = new WWW::Mechanize::Firefox; | |
$mech->allow( | |
javascript => 1, | |
metaredirects => 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
port list active | cut -c-31 | sort -u > ports.now | |
grep -v -F -f ports.now ports.old | grep -v '^p5' | tr -d ' ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MULTILINESTRING( | |
(A,B,C,D,E), | |
(F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U), | |
(F,G,H,I,J,K,L,M,N,V,W,X,Y,Z), | |
(U,T,S,R,Q,P,O,N,V,W,X,Y,Z) | |
) |