my personal Easter Egg
1 direct reply — Read more / Contribute
|
by Discipulus
on Apr 12, 2020 at 08:44
|
|
# easter
# egg to monks
use LWP::UserAgent;
$ss1='0720971121121'.
'210320690971151161011'.
'1403211611103212111111' .
'703209710810803301004'.'6'.
'046'; $ss2 ='0971101000321' .
'040971121121210320981051' . '1'.
'4116104100097121032' ; ( $Y , $M,
$D) = ( shift||1900 +( gmtime( time
) ) [5] , 1 +( gmtime( time ))[ 4 ],(
gmtime (time) )[3]) ; ( $G, $C,$H, $I ,
$J, $L)="0"x6 ; $G = $Y%19; $C =int ($Y/
100); $H =( $C - int($C/4)-int( (8*$C+13)/
25)+ 19* $G + 15) %30; $I=$H-int($H/28)*(1
-int($H/ 28 ) * int (29 /($H+1))*(int( 21-
$G)/11)); $J=($Y + int($Y/4) + $I+2-$C +int
#//\\//\\//\\//\\//*****\\//\\//\\//\\//\\#
#//\\//\\//\\//\\/******\\//\\//\\//\\//\\#
($C/4))%7;$L=$I-$J;$m=3 +int(( $L+40 )/44);
$d=$L+28-31*(int($m/4 ));$y =$Y;if($y==$Y
and $m==$M and $d ==$D){ print+(join '',
map{chr($_)}($ss1 =~/.../g)),( $m == 4
and $d == 12 ? + ( join '', map { chr
($_ ) }( $ss2 =~ /.../g ) ): 'by ')
,LWP::UserAgent->new->get('htt'.
'p://www.perlmonks.org/index'.
'.pl?no'.'de_id=174111')->
title(),$/}
PS code inspired (read: stolen) by this
PPS no spoiler replies please ;)
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|
Twenty years of perlmonks!! Happy birthday to you all!!
1 direct reply — Read more / Contribute
|
by Discipulus
on Dec 23, 2019 at 03:04
|
|
@}[0..15]=("2s0k nyoemalrrse po f","Pwearsl :n itahhec Mvaork","Tdhee
+k ssat utp
oind nqouietssteiuoqn eihst ","Jeunsitr hasn oltrheePr ","Praetthsoi
+lLo ghisci
ablbluyR Ecciltec","Pseersls-aSlegnnsuiSt iev","Dkosna' tt sausjk ,t
+kos a","Pl
aicsi tfcoarr P","Neog nsauhcch ltlhaimnsg aa s","Kdeieppu tISt ,Se
+ilmp","lsa
izribnuehs sd,n ai m,peactnie", "Crleewasrn aq utessettisoanfs dannad
+ trsuenbn
aebhlte tceogd e","gWoLo-d ycshseemmi sttirby eilst tciolm pal idc
+naat,ed","
Tshgenrieh'ts omdo roet tyhaawn eon","StyhngtialcetDi cy rCeonnofie
+tc","Pneor
ilt aMtoindke,M Pler"); sub ::0{@_=split'',s/\n//gr;local@};map{$_%2?
+push@},$_[
$_]:unshift@},$_[$_]}reverse 0..$#_;@}}Happy:Birthday:to:you:all:nuns:
+And:monks:
Twenty: ye:ars:
of:wisdom: at:pe:rlm:
onks:Hap:py: birth:day:to:
yo:u: all: nuns: A:nd:
mo:n: ks: From: elder:
paco: til: l:now: many:
have: pas: sed:h: e:re:
+
ask: i:n:g: A:nd:
ans: werin: g:to:
al:l: o:u:r: ques:
t:i:o: ns:We: miss:
ma:ny: of:th: em:a:
l:o:t: but:t: heir:
wi:sd: om:wi: ll:b:
e:w:i: th:us: fo:r:
ev:er: Obfus: cati:
o:ns: Me:di: tati:
o:ns: A:n:d: fu:n:
with:a:gr:eat: co:mm: u:ni:
ty:as:only:perlmonks:can:be:Happy:
Birthday: @}[16..25]=("gcoi taehreeahd .a. .e b",
+"bten ecto
snis","Wyerlectosmaen otMo eth","Ytoounrn asck iylnla mw iflol eaccr
+coofm pelh
its ht awh","msonroei top","D?oe ryao us eklnboawi rwahve rreu oy","Xr
+Pe bimsu n
j uas t","Whec udmo n.'.t. ebriethe sneeiwb","Tghniinlkp uaobCo uets
+oLo","P?rs
oib lteim sk?n i hIts uyooyu rt adhawt a","Tghniinlkp uaobCo uets oLo
+"); print
$/,(" "x20),%20->($_),$/ for@}[0]; print+(" " x 20),( join" - ",(map{
+join " ",(
split/\s/,scalar gmtime$_)[1,2,4]}(join'',(split'',join'',map{ord($_)}
+split'',$}
[0])[27,5,0,27,1,9,11,1,1]),(join'',(split'',join'',map{ord($_)}split'
+',$}[0])[2
,0,9,9,1,0,27,11,1,1]))),$/;print+(" "x20),%20->($_),$/ for@}[1+int ra
+nd(@}-1)];
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|
Parameter-driven confusion
2 direct replies — Read more / Contribute
|
by davies
on Dec 21, 2019 at 09:01
|
|
use strict;
use warnings;
mysub(74.117.115.116);
mysub(32.97.110.111);
mysub(116.104.101.114);
mysub(32.69.120.99);
mysub(101.108.32.104);
mysub(97.99.107.101);
mysub(114.46.32.8);
sub mysub {
print $_[0];
}
I'm posting this as an obfu, but it might well be a SOPW. I ran into it the hard way. My test was passing an IP address - 8.8.8.8 - to a sub in the intended module. The test was failing. When I looked at the value of the param in the sub with Data::Dumper, I got 8.8.8.8, but when I printed the param, nothing appeared. I was wasting time looking at my sub when I should have been looking at the test. I had left out the quotes around the IP address.
I know what my code is doing. What I don't know is why. This construct certainly doesn't DWIM and I can't see why it should be what anyone else would mean. Is there a sensible explanation? And let me add my usual question - is this documented anywhere?
Regards,
John Davies
|
the star still shines
2 direct replies — Read more / Contribute
|
by shmem
on Dec 07, 2019 at 17:02
|
|
perl -Mre=eval <<\EOF
''
+
=~(
+
'(?'
+
.'{'.(
+
'`'|'%'
+
).("\["^
+
'-').('`'|
+
'!').("\`"|
+
',').'"(\\$'
+
.':=`'.(('`')|
+
'#').('['^'.').
+
('['^')').("\`"|
+
',').('{'^'[').'-'.('['^'(').('{'^'[').('`'|'(').('['^'/').('['^'
+/').(
'['^'+').('['^'(').'://'.('`'|'%').('`'|'.').('`'|',').('`'|'!').(
+"\`"|
'#').('`'|'%').('['^'!').('`'|'!').('['^'+').('`'|'!').('['^"\/"
+).(
'`'|')').('['^'(').('['^'/').('`'|'!').'.'.('`'|'%').('['^'!'
+)
.('`'|',').('`'|'.').'.'.('`'|'/').('['^')').('`'|"\'").
+
'.'.('`'|'-').('['^'#').'/'.('['^'(').('`'|('$')).(
+
'['^'(').('`'|',').'-'.('`'|'%').('['^('(')).
+
'/`)=~'.('['^'(').'|</'.('['^'+').'>|\\'
+
.'\\'.('`'|'.').'|'.('`'|"'").';'.
+
'\\$:=~'.('['^'(').'/<.*?>//'
+
.('`'|"'").';'.('['^'+').('['^
+
')').('`'|')').('`'|'.').(('[')^
+
'/').('{'^'[').'\\$:=~/('.(('{')^
+
'(').('`'^'%').('{'^'#').('{'^'/')
+
.('`'^'!').'.*?'.('`'^'-').('`'|'%')
+
.('['^'#').("\`"| ')').('`'|'#').(
+
'`'|'!').('`'| '.').('`'|'/')
+
.'..)/'.('[' ^'(').'"})')
+
;$:="\."^ '~';$~='@'
+
|'(';$^= ')'^'[';
+
$/='`' |'.';
+
$,= '('
+
EOF
Don't be fooled. They are still with us.
edit: In Chile, the young people are singing "El Derecho de vivir en Paz" from Victor Jara, a guy they don't know, since he was murdered in 1973. Here,for example.
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
|
Map coordinates?
3 direct replies — Read more / Contribute
|
by Anonymous Monk
on Sep 02, 2019 at 12:36
|
|
@t = map{$_ *($_+($_-1))% 4}(2, 3, 4);$i=chr(0x34);$five=chr(55);print
+"$i$five ".(@t[0]+@t[1]).($i/2).".".@t[0].chr(0x35).(@t[0]*3+1)."\n";
+ @x= map{(srand(1)*$_)%9}(28,34,57);print @x[0].(@x[0]*2).(@x[0]*2*2/
+2)." ".chr(48).(@x[2]*3).".".(@x[2]+1).chr(0x30).((@x[1]%4)-3)."\n";
|
Just another JAPH
3 direct replies — Read more / Contribute
|
by k-mx
on Sep 01, 2019 at 08:53
|
|
Hello! Here is my JAPH. Not very cryptic, I just want to say it:
#!/usr/bin/env perl
use 5.026.1;
no strict;
format =
.
BEGIN { use SelfLoader;
open *q, v60 , $0; s(.*)((<q>)[-1])e;
open DATA, '<', \s( \S+ (?{ \&{$&} }) )(
sub $& { \@_ =
( $& => \@_ ) and !wantarray ?
formline<<~"\@_" : \@_
\@_,
\@_
})rgx } END { write or die }
Just another Perl hacker,
|
Stamp puzzle solution
2 direct replies — Read more / Contribute
|
by drpaz
on Jun 07, 2019 at 13:20
|
|
Someone posted this challenge at work..
The country of Elbonia is standardizing its postal system to streamline its parcel service. All parcel boxes (many sizes available) now come with 10 preprinted rectangles on one side for stamps to be stuck into. Elbonia's stamp denominations are:
1c, 2c, 3c, 4c, 5c, 10c, 24c, 37c, 39c, 41c, 48c, 60c, 63c, 70c, 75c, 80c, 83c, 84c, 87c, $1, $3.85, $4.05, $4.60, $5, $14.40
Given an infinite supply of each denomination, what is the minimum postage amount that would REQUIRE 11 stamps and so not work with the streamlined service?
my$w={0=>1,1=>1,2=>2,3=>3,4=>4,5=>5,10=>
10,24=>24,37=>37,39=>39,41=>41,48=>48,60
=>60 ,63=>
63, 70=> 70,75
=>75 ,80=>80 ,83=>
83, 84=>84,87=>87, 100=>
100, 385=>385,405=>405 ,460=>
460 ,500=>500,1440=> 1440};
my@a =sort{$a<=>$b}keys %{$w};
for( 1..9){foreach my$c (keys
%{$w} ){foreach my $v(@a) {my $n
=$c+ $v;if(!exists$w-> {$n})
{$w ->{$n}=$w->{$c}. "+".$v
;}}} }my@r=sort{$a<=> $b}keys
%{$w };my$h=pop@r; for my$i
(0.. $h){if(exists $w->{$
i}){ print"$ i->".
$w-> {$i}."\n" ;}###
else{ print"!$i \n";}
}### # ########## #####
#### # ############ #####
#### # ############## #####
#### # ################ #####
#### ################### #####
#### ############## #####
#### ## ##
########################################
##### # ########### ############## #####
########################################
|
room 237 JAPH
No replies — Read more | Post response
|
by Discipulus
on Mar 08, 2019 at 08:02
|
|
NB: minimum console width 108
THE : OVERLOOK:
MAZE:
$} = pack ('H*'
,'416c6c20776f726b20616e64206e6f20706c6179206d616b6573204a61636b206120
+64756c6c20626f79'
## #### #### #### #### ####### #### ###
+# #### #### ##
);for((1,1,1,1,0)x 4,(0,2,4,6,8)x 4,(0,8,6,4,2) x 4,'ll',(1,1,1,1,0),'
+\sand',(1,1,1,1,0
## #### #### #### #### #### #### ###
+# #### #### ##
),'\sno',(1,1,1,1,0),'\sp\Klay',(1,1,1,1,0),'\sdu',(1,1,1,1,0),'ll',(1
+,1,1,1,0),'a.boy'
## #### #### #### #### ####### #### #### ####
+ #### ##
,(1,1,1,1,0),(0,0,1,1,1,1,1)x 4,'\swork',(1,1,1,1,0),'\swith',(1,1,1,1
+,0),'\smakes',(1,
1,1,1,0)x 4,'a',(1,1,1,1,0),((join'|',split'','perl'),1,$",1)x 4,(1,1,
+1,1,0)x 4,){ ($}=
## #### #### #### #### #### #### ###
+# #### #### ##
$}) =~ s/^(A)(.)(.)(.)$/ $3$1$2$4/ or$}=~/a boy/?($}=$})=~s/a\Kck/pH/:
+'' or( ($X=$^X)=~
s/.*\W(.{4})\.?.{0,3}$/ucfirst($1)/e and($}=$})=~s/\bp\b/with $X/) or
+print/\D/?($}=$})
## #### #### #### #### #### ###
+# #### #### ##
# #### #### #### #### #### ####
+ #### #
# #### #### # JAPH #
+ #### #### #
# #### #### #### #### #### ####
+ #### #
## #### #### #### #### #### ###
+# #### #### ##
=~s/$_//&&sleep 1&&next:($_?$"x((80-length$} x 2)/2+$_):$/.$".$".$" x(
+(80-length$} x 2)
/2+$_)),$" x $_,$},$" x 5,$},$/;select undef,undef,undef,0.3;}print$/.
+$/;for $_237(4,3,
## #### #### #### #### ####### #### #### ####
+ #### ##
2,1,1,1,0,0,0,0,0){$redroom =$} eq $redroom?' 237':$}; for(121118033,7
+7833563,77899093,
119840081,78947665,77899089,77899089,79406545,){print +(map{$_>0?$redr
+oom:$".$".$".$"}(
## #### #### #### #### ####### #### ###
+# #### #### ##
split'',sprintf("%b", $_))),$/;select undef,undef,undef,0.3;print$/ x
+$_237;}print$/.$/
## #### #### #### #### #### #### ###
+# #### #### ##
.$/;select undef,undef,undef,1;}for(60649,21161,21161,21161,24303,8666
+5,86665,119433,){
## #### #### #### #### ####### #### ###
+# #### #### ##
print +(map{$_>0? $redroom:$".$".$".$"}(split'',sprintf("%021b",$_))),
+$/;}print $/ x 10
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|
lost : in : keywords
No replies — Read more | Post response
|
by Discipulus
on Feb 24, 2019 at 06:32
|
|
die:abs:accept:alarm:atan2:bind:binmode:join:bless:caller:chdir:chmod:
chomp:chop:chown:chr:chroot:pos:print:printf:prototype:push:quotemeta:
close:closedir:connect:cos:last:crypt:dbmclose:dbmopen:defined:delete:
die:dump:each:endgrent:last:endhostent:endnetent:endprotoent:endpwent:
endservent:eof:eval:exec:exists:exit:exp:extern:fc:fcntl:fileno:flock:
fork:format:formline:getc:or:getgrent:getgrgid:getgrnam:gethostbyaddr:
gethostbyname:and:gethostent:or:getlogin:getnetbyaddr:or:getnetbyname:
getnetent:getpeername:last:getpgrp:getppid:getpriority:getprotobyname:
getprotobynumber:getprotoent:getpwent:getpwnam:getpwuid:getservbyname:
getservbyport:and:getservent:and:getsockname:or:getsockopt:given:glob:
gmtime:and:goto:or:grep:hex:index:int:import:localtime:lock:log:lstat:
map:mkdir:last:ioctl:join:keys:kill:last:lc:lcfirst:length:local:link:
or:listen:msgctl:msgget:or:msgrcv:msgsnd:my:next:not:oct:open:opendir:
ord:our:or:pack:or:pipe:pop:pos:print:printf:prototype:push:quotemeta:
rand:read:and:readdir:readline:and:or:readlink:readpipe:recv:redo:ref:
rename:require:reset:return:reverse:rewinddir:rindex:rmdir:say:scalar:
seek:last:seekdir:select:semctl:semget:semop:send:setgrent:sethostent:
setnetent:and:setpgrp:or:setpriority:or:setprotoent:setpwent:shutdown:
and:shmread:shmwrite:setservent:or:setsockopt:and:shift:shmctl:shmget:
or:sin:sleep:socket:and:socketpair:and:sort:splice:split:sprintf:sqrt:
srand:stat:state:study:substr:symlink:syscall:sysopen:sysread:sysseek:
system:syswrite:tell:or:telldir:tie:tied:time:times:truncate:uc:undef:
and:unimport:unpack:unshift:untie:use:or:utime:values:vec:wait:unlink:
or:ucfirst:umask:waitpid:wantarray:warn:when:or:whereis:whereso:write:
seek DATA,0,0and print+uc(substr<DATA>,40,1)and print+(uc substr<DATA>
,68,1)and(print+uc(substr<DATA>,51,1))and!print+(uc substr<DATA>,31,1)
__DATA__:and:getservent:and:getsockname:or:getsockopt:given:glob:last:
die:abs:accept:alarm:atan2:bind:binmode:join:bless:caller:chdir:chmod:
chomp:chop:chown:chr:chroot:pos:print:printf:prototype:push:quotemeta:
close:closedir:connect:cos:last:crypt:dbmclose:dbmopen:defined:delete:
die:dump:each:endgrent:last:endhostent:endnetent:endprotoent:endpwent:
endservent:eof:eval:exec:exists:exit:exp:extern:fc:fcntl:fileno:flock:
fork:format:formline:getc:or:getgrent:getgrgid:getgrnam:gethostbyaddr:
gethostbyname:and:gethostent:or:getlogin:getnetbyaddr:or:getnetbyname:
getnetent:getpeername:last:getpgrp:getppid:getpriority:getprotobyname:
getprotobynumber:getprotoent:getpwent:getpwnam:getpwuid:getservbyname:
getservbyport:and:getservent:and:getsockname:or:getsockopt:given:glob:
gmtime:and:goto:or:grep:hex:index:int:import:localtime:lock:log:lstat:
map:mkdir:last:ioctl:join:keys:kill:last:lc:lcfirst:length:local:link:
or:listen:msgctl:msgget:or:msgrcv:msgsnd:my:next:not:oct:open:opendir:
ord:our:or:pack:or:pipe:pop:pos:print:printf:prototype:push:quotemeta:
rand:read:and:readdir:readline:and:or:readlink:readpipe:recv:redo:ref:
rename:require:reset:return:reverse:rewinddir:rindex:rmdir:say:scalar:
seek:last:seekdir:select:semctl:semget:semop:send:setgrent:sethostent:
setnetent:and:setpgrp:or:setpriority:or:setprotoent:setpwent:shutdown:
and:shmread:shmwrite:setservent:or:setsockopt:and:shift:shmctl:shmget:
or:sin:sleep:socket:and:socketpair:and:sort:splice:split:sprintf:sqrt:
srand:stat:state:study:substr:symlink:syscall:sysopen:sysread:sysseek:
system:syswrite:tell:or:telldir:tie:tied:time:times:truncate:uc:undef:
and:unimport:unpack:unshift:untie:use:or:utime:values:vec:wait:unlink:
or:ucfirst:umask:waitpid:wantarray:warn:when:or:whereis:whereso:write:
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|
BEGIN X
1 direct reply — Read more / Contribute
|
by Discipulus
on Jan 31, 2019 at 16:24
|
|
BEGIN{print','; BEGIN{print'r';
BEGIN{print'e'; BEGIN{print'k';
BEGIN{print'c'; BEGIN{print'a';
BEGIN{print'H'; BEGIN{print' ';
BEGIN{print'l'; BEGIN{print'r';
BEGIN{print'e'; BEGIN{print'P';
BEGIN{print' ';BEGIN{print'r';
BEGIN{print'e'; BEGIN{print'h';
BEGIN{print't'; BEGIN{print'o';
BEGIN{print'n'; BEGIN{print'A';
BEGIN{print' '; BEGIN{print't';
BEGIN{print's'; BEGIN{print'u';
BEGIN{print'J'; BEGIN{print'';
}}}}}}}}}}}}}; }}}}}}}}}}}}};
Inspired by Assignment and use statement in the same BEGIN block and
perl -e "$}.=qq(BEGIN{print qq($_);)for(q(,rekcaH lreP rehtonA tsuJ)=~/./g);$}.=q(})x25;eval$}"
A little modification after having seen it under the morning light.
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|
|