Perl signature programs
Signature programs are short programs that
people have been using as part of their signature. They are small
(2 to 4 lines) programs, that are often rather cryptic because they
have to save space as much as possible. The Perl program language is
rather compact programming language which allows to write cryptical
code. For this reason it is not strange that it is often used for
signature programs.
Randal Schwartz wrote a lot of `Just Another Perl Hacker,' program
signatures.
Please read the story behind this signature program, as it is the signature program
with the highest number of contributers.
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
The Perl encoded signature of
Alun Jones
$_='\=*Sxw!jds@j$.jl.dt#Rw%^dcn"K1x(=Bl1nwl!\*1enab^h"F=!J$h%fhcq',
tr&J-ZA-Ij-za-i&A-Za-z&&s&\(&logic&&&s&\*&un&g&s&=&al&g&s&\^&it&g&&
s&%&st&g&&s&\$&ber&g&s&\#&\n&&s&"& of&g,s&([A-Z])& $1&g&&s&\\u&U&&&
s&!&es, &g&s&\\a&A&&s&1&i&g&&print" $_\n";sub liminal{"use perl!";}
Another Perl program by him:
$_=join("\:",@w=sort(split("\_","Once,_nab_Cones_per._yac._fuj@_BunJ_AAl_Fept
.+_MSc_Io_Kute_D,_Jmp_Go_ED_Nie_RAber_Twy_Uth.+_HfC_PU._QW._Lr_zukss_ba_Syst_
")));s/\n//g;s/ss/\n/;s/\:.//g;s/([A-Y])/\ $1/g;s/\s+\A+/\A/;s/\+/\/g;print;
Here is a perl 5 ASCII Mandelbrot program. (Hardly worth the effort really,
everyone does them, he commented):
#!perl -i(X,Y,S,U,V,$_)=(-2,-2,4,80,40,"\n");if($#a>1){(X,Y,S)=@a}for((B,I)=Y+
@a=@ARGV,split('',' Alun Jones, IBS UW Aberystwyth, auj@aber.ac.uk ');$_=$^I.'
S;I++<V;B-=S/V){for((A,J)=X;J++<U;A+=S/U){(G,H,N)=(A,B);while((C=G*G)+(D=H*H)<
4&&++N<$#_){H=2*G*H+B,G=C-D+A}print$_[N]}print;A+=S/U}';s/([A-Z])/\$\1/g;eval;
He has some more signature programs.
Encryption Perl script by Joey Hess
#!/usr/bin/perl -pl- ,,ep) ayf >|)nj,,
$_=reverse lc$_;s@"@''@g;y/[]{A-R}<>()a-y1-9,!.?\`'/][} Joey Hess
{><)(eq)paj6y!fk7wuodbjsfn^mxhl5Eh29L86\`i'%,/;s@k@>|@g#
He has also written some other
signature programs.
# alec muffett, internet services, sun uk
# below: 'crack' in one line of perl; usage: [cmdline] dictionary ...
perl -nle 'setpwent;crypt($_,$c)eq$c&&print"$u $_"while(($u,$c)=getpwent);
perl -e 'srand;for($i=0;$i<4;$i++){$a[$i]=int rand 8;for($j=0;$j<$i;$j++){$i--
if $a[$i]==$a[$j];}}print"A B C D GP\n";do{system"stty cbreak";$e=$p=0;for($i=0
;$i<4;$i++){$b=getc()&7;print" ";$p++ if $b==$a[$i];for($j=0;$j<4;$j++){$e++ if
$b==$a[$j]}}system"stty cooked";print $e-$p,$p,"\n";}while $p<4;'#Martin Haring
(This was written with Perl 5.)
He also has a C version of this signature.
A math test style program:
srand($$|time);print"MAX:";chop($x=<STDIN>);for(;;){$a=int(rand($x));$b=int
(rand($x));print"$a + $b = ";$c=<STDIN>;($a+$b==$c)||die"WRONG after $d\n";
print "OK\n";$d++;} # Run this with perl. Jonathan Westhues
A line editor:
while(<>){push(@A,$_);}while(1){print")";chop($q=<STDIN>);# Line editor.
$q eq'l'&&do{foreach(@ A){print;}};$q eq'q'&&exit 0;$_=$q;# By Jonathan
if(/s\s(.*)/){open(F,">".$1);foreach(@A){print F $_;}};$_# Westhues
=$q;if(/c\s(\d*)\s(.*)/){@A[$1]=$2."\n";}} # jwesthue
A guess-the-numbers game:
srand($$);$a=int(rand(10))+1;for(;;){$b=<STDIN>;$b<$a&&print"H\n";$b>$a&&
print"L\n";$b==$4&&die"OK\n";} # Jonathan Westhues
A simple hangman game:
@N = split(//,'jonathan');@R = (1..9); for(;;){$_ = <STDIN>;
chop;for($c=0; $c<8; $c++){if($_ eq $N[$c]){$R[$c]=$_;$f=1;}print $R[$c];
}print "\n";} # Jonathan Westhues: this isn't obvious!
A primes calculator with included 'performance meter':
open(O,">/tmp/$$");print O"while true\ndo\necho -n ' '\n sleep 1 \n done";
close(O); system"sh /tmp/$$ &";for(;;){$c++;$f=0;for($i=2;$i<$c;$i++){
(($c%$i)!=0)||do{$f=1;}}$f||print"$c\n";}
A dc-ish RPN calculator:
print "> ";while(<STDIN>){chop;if(/^\d*$/){push(@A,$_);}if($_
eq'l'){foreach(@A){print $_."\n";}}$_ eq'+'&&print pop(@A)+pop(@A);$_
eq'-'&&print 0-(pop(@A)-pop(@A));$_ eq '*'&&print pop(@A)*pop(@A);$_
eq'/'&&print 1/(pop(@A)/pop(@A));print
"\n"if(/\+|\-|\*|\//);$_ eq'q'&&exit 0;$_ eq'p'&&pop(@A);print"> ";}
Print out words matching certain ascii totals:
while(<STDIN>){chop;@A=split(//);foreach(@A){$t+=ord;}if($t==$ARGV[0]){print$_.
"\n";}print"$_ $t\n"if!$ARGV[0];$t = 0;}
(For those of us who care that the total of the ascii codes in 'soviet' 666.)
#!/usr/local/bin/perl5
++$_;$_+=$_+++$_;$!=$_+$_;($:,$,,$/)=$!=~/.(.).(.)(.)/; $_+=$_+++$_+$_; ($^,
$\,$~)=($!=$_)=~/(.) (.).*(.)$/; $_-=$_;$|=++$_;$_++; `$^$,$/$: $\$~ $|>&$_`
#!perl -wlpifinger.liv.ac.uk # If it doesn't work see doio.c line ~256
BEGIN{use Socket;$_='YIN;sockefPZSOCK_STREAM,~proto"tcp"and$|=connecfpack"
Sna4x8",AZ79,$;=~host$^Ior die$!;print"/w nickc\r"YOUT;print"[$^I]"';s/f/t
STDIN,/g;s/Y/;select STD/g;s/Z/F_INET,/g;s/~(\w*)/get$1byname/g;eval||die}
His signature contain the following perl fragment:
$0='!/sfldbi!yjoV0msfQ!sfiupob!utvK'x44;print map{("\e[7m \e[0m",chr ord
(chop$0)-1)[$_].("\n")[++$i%77]}split//,unpack'B*',pack'H*',($F='F'x19).
"F0F3E0607879CC1E0F0F339F3FF399C666733333CCF87F99E6133999999E67CFFCCF3".
"219CC1CCC033E7E660198CCE4E66798303873CCE60F3387$F"#Don't you love Perl?
It is preceded by the statement "The mere formulation of a problem is
far more essential than its solution" by Albert Einstein.
$_=q{$_=q{Q};s/Q/$_/;print};s/Q/$_/;print
HTTP 0.9 server signature by
Joe Futrelle
use Socket;socket(S,PF_INET,SOCK_STREAM,getprotobyname('tcp'));setsockopt(S,
SOL_SOCKET,SO_REUSEADDR,pack("l",1));bind(S,sockaddr_in($ARGV[0],INADDR_ANY)
);listen(S,5);for(;accept(C,S);close C){$_=<C>;/^GET (.*) /;while(<C>=~/:/){
}open F,"<$ARGV[1]$1";print C"HTTP/0.9 200\n\n";while($l=<F>){print C$l;}}
This 5-line version supports CGI:
use Socket;socket(S,PF_INET,SOCK_STREAM,getprotobyname('tcp'));setsockopt
(S,SOL_SOCKET,SO_REUSEADDR,pack("l",1));bind(S,sockaddr_in($ARGV[0],
INADDR_ANY));listen(S,5);for(;accept(C,S);close C){$_=<C>;/^GET (.*) /;
open F,/ (\/cgi-bin\/.*) /?"$ARGV[1]$1|":"<$ARGV[1]$1";while(<C>=~/\:/){}
print C"HTTP/0.9 200 OK\n\n";while($l=<F>){print C$l;}}
$_='while(read+STDIN,$_,2048){$a=29;$b=73;$c=142;$ t=255;@t=map{$_%16or$t^=$c^=($m=(11,10,116,100,11, 122,20,100)[$_/1
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$; =sub{$a.$b->()}}split//, ".rekcah lreP rehtona tsuJ";$\=$;->();print$/
-- perl -e'print pack"H*","64706f6d657279406375632e6564750a"' /. ate my old sig. Bastards.
Signature programs |
home and email