forked from mame/quine-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQR.rb
65 lines (65 loc) · 15.7 KB
/
QR.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
eval$s=%q(eval(%w(B=92.chr;g=32.chr;puts(eval(%q(N=10.chr;n=0;e=->s{Q[Q[s,B],?"].K(N,B+?n)};E=->s{'("'+e[s]+'")'};d=->s,t=?"{s.K(t){t+t}};def~f(s,n)s.K(/.{1,#{n*255}}/m){yield$S=E[$s=$&]}end;Q=->s,t=?${s.K(t){B+$&}};R=";return~0;";V=->s,a,z{s.K(/(
#{B*4})+/){a+"#{$&.size/2}"+z}};C=%w(System.Console~Write);$C=C*?.;$D="program~QR";$G="~contents~of"+$F="~the~mix!g~bowl";$L="public~static";rp=->s,r{v="";[r.!ject(s){|s,j|o={};m=n=0;s.size.times{|i|o[f=s[i,2]]||=0;c=o[f]+=1;m<c&&(m=c;n=f)};v=n+v;
s.K(n,(j%256).chr)},v]};%(fn~mX{Z`x21("{}",#{E["object~QR~extends~App{#{f(%((display"1d;s/.//;s/1/~the~sum~of~a~son~and0/g;s/0/~twice/g;s/2/`x59ou~are~as~bad~as/g;s/3/~a~son`x21Speak~your~m!d`x21/g^n#The~Relay~of~Qu!e.^n#Ajax,~a~man.^n#Ford,~a~man
.^n#Act~i:~Qu!e.^n#Scene~i:~Relay.^n#[Enter~Ajax~and~Ford]^n#Ajax:^n#")(def!e(f~n~m)(if(=~n~1)(display(+(*~m~10)3))(f(quotient~n~2)(+(*~m~10)(modulo~n~2)))))(def!e(g~_~n)(if(>~n~0)(g(f(modulo~n~256)2)(quotient~n~256))))(g~0(sJ->number"#{s,v=rp["Tr
anscript~show:~'#{d["Z"+E[%(fun~p~n=Z(Int.toSJ~n`x5e"~");p~0;p~0;p~130;List.tabulate(127,p);SJ.map(fn~c=>(p(3+ord~c);Z"-1~0~";c))#{E[%(puts~"#{Q[e[%(echo~'a::=`x7e#{Q[Q["let~s=#{E[%(void~p(!t[]c){foreach(!t~v~!~c)stdout.Zf("%c%c",v/256,v%256);}voi
d~mX{!t[]a;p({19796,26724,0,6,0,1,480,19796,29291,#{s=%(module~QR;!itial~beg!~#{f("let~s=#{E[%(Module~QR:Sub~MX:Dim~s,n,i,c~As~Object:n=Chr(10):For~Each~c~!"#{d["<?xml#{O="~version='1.0'"}?><?xml-#{I="stylesheet"}~type='text/xsl'href='QR.xslt'?><x
sl:#{I+O}~xmlns:xsl='http://www.w3.org/1999/`x58SL/Transform'><xsl:output~method='text'/><#{U="xsl:template"}~match='/'><`x21[CDATA[#{%(sub~f(s$,n)Z(s$);:for~i=1to~n~Z("Y");:next:end~sub:f("#{V[e[%(H,format="#{y="";f("^H{-}{txt}{#{Q["echo~-E~$'#{Q
[Q[E[%(with~Ada.Text_Io;procedure~qr~is~beg!~Ada.Text_Io.Put("#{d[%(!terp:library"afnix-sio"`ntrans~O(n){trans~o(afnix:sio:OutputTerm)`no:H(Byte(+~128~n))}`ntrans~f(v~n){`nO(+(/~n~64)107)`nO(n:mod~64)`nO~v}`ntrans~D(n){if(<~n~4){f(+(*~6~n)9)48}{if
(n:odd-p){D(-~n~3)`nf~27~48`nf~36~11}{D(/~n~2)`nf~21~48`nf~48~20}}}`ntrans~S"#{e[%W[STRINGz:=~226+~153,a:=z+~166,b:=a+"2"+z+~160,c:=b+"8"+z+~165,t:="#!clude<iostream>"+~(10)+"!t"+~(32)+"mX{puts#{d[E[%(class~QR{#$L~void~ma!(SJ[]a){a=#{E["H('#{Q[e["
implement~ma!0()=Z"+E["BEGIN{Z#{E[%(echo~'#{%(f(s){System.out. Z(s);}s=" 389**6+44*6+00p45*,";for(c:#{E[(s="#!clude<iostream>`n!t~mX{std::cout<<#{E[%(class~Program{#$L~void~MX{#$C("Qu!e~Relay~Coffee.^n^nIngredients.^n");for(!t~i=9;i++<126;)#$C($"
{i}~g~caffe!e~{i}^n");#$C("^nMethod.^n");foreach(ch ar~c~! #{E[ %((doseq [s(lazy-cat["IDENTIFICATION~DIVISION.""PROGRAM-ID.~QR.""PROCEDURE~DIVISION."'DISPLA`x59](map~#(str"~~~~^""(.replace~%1"^"""^"^"")"^"")(re-seq~#".{1,45}""#{e["(f=(
n)->Array(n+1).jo!~'Y');console.log('%s',#{V[E[%( (H- l !e"#{e["ma!=putStr"+E["import~std.stdio;void~mX{H(`x60#{%(method~MX{Z(@"#{d["[#{%(cl ass~QR:Application{void~f(SJ~const~s,!t~n){for(Pr!t(s);n;n--)Pr
!t("Y");}void~MX{#{f("IO.puts"+E[%((pr!c~"#{e[" `n ma!(_)->`nio:fH#{d[E['Zfn("""'+d[?"+"%option~noyywrap`n%%`n%%`n !t~mX{puts#{E["echo~'#{Q[Q[%(~:~A~."#{g*9}"~;~:~B~A~."~
WRITE(*,*)'"~A~;~:~C~B~T`x59PE~."~'"~CR~;~:~D ~S"~#$D"~C~S^"~Z~^"(&"~C~S^"~#{e[%(Z"#{e["s:=OutputTextUser( );WriteAll(s,#{E[%(Zf"#{e[d[f(".template~1`n#{d['s
et~Z"-";Z'+E[%(package~ma!;import"fmt";func~ mX{fmt.Pr!t#{E[%(236:j;{119:i;{206i-:i;.48<{71+}{ [i]^48-*}if}%}:t;"013141"t"/12131"t~6*"/1:1918
151:??6271413/4=3626612/2/353251215/`x5a0`x 5a0R"t"#{e[%(show~"z=new~java.util.zip.G`x 5aIPOutputStream(System.out);z.H('#{"ma!=pu
tStr"+E["class~QR{#$L~function~mX{neko.Li b.Z#{E[%(procedure~mX;i:=c:=0;s:=#{E[%(.c lass~public~QR`n.super~#{$T="java/io/Pr!
tStream"}`n.method~#$L~ma!([L#{S="java/ lang /S"}J;)V~;]`n.limit~stack~2`ngetst atic~#{S}ystem /out~L#$T;`nldc~"#{e[%(class~QR{#$L~v
oid~ma!(SJ[]v){SJ~c[]=new~SJ[99999],y= "",z= y,s="#{z=t=(0..r=q=126).map{ |n|[n,[]]};a="";b=->n{a<<(n% 78+55)%84+42};(%(P={0:'[+[]]',m:'((+
[])'+(C="['constructor']")+"+[])['11' ]"}; for(R~!~B=('`x21[]@`x21`x21 []@[][[]]@'+(A="[]['fill']")+"@([]+[]) ['fontcolor']([])@(+('11e20')+[])[
'split']([])@"+A+C+"('return~escape') ()("+A+')').split('@') )for(E~!~D=eval(G='('+ B[R]+'+[])'))P[T=D[E]]=P[T]||G+"['"+E+"']";f or(G='[',B=0;++B<36;)P[D=B.toSJ(
36)]=B<10?(G+='+`x21+[]')+']':P[D]||" (+(' "+B+"'))['to'+([]+[])"+C+"['name'] ]('36')";A+=C+"(' console.log(unescape(^"";for(E~!~G=#{E[%(s=();a(){ ~s+=($(echo~-n~$1|od~-An~-tu1~-
v)~$2);};a~"Section`x48eader+name:=QR;S ectionPublic-ma!<-("~10;t='#{%(Z("""#{Q[e["consol e.log"+Q[E[%( @s=global[#{i=(s=%(`x48AI~1.2`nVISIBLE~"#{"x=sJ.K(#{V[ E["changequote(<@,@>)`ndef!e(
p,<@#{"all:`n`t@echo~'#{d["l!el:9999 9;Z#{E["solve~satisfy;output~[#{E[%(.assembly~t{}.m ethod~#$L~vo id~MX{.entrypo!t~ldstr"#{e["m{{`x21:~x`nqr:~|-`n~:db`x60#{ e[s="$Z#{E["Zf#{E["echo"+E["
#import<stdio.h>#{N}!t~mX{puts#{E ["Z_sJ"+E["s=toascii#{E["Z#{E["$console:l!e[#{"#$D(outpu t);beg!~ H(#{f((p="eval";%($_="#{s,v=rp["$_='#{Q[%(<?php~$z=3+$w=strle n($s=#{Q[E["!t~mX{H#{E["(#{
?_*11})dup~=/s(|~~~~~.~~~|)def(# {Q["qr:-H('#{Q[e["!it{#{f(%(Z('cat("')`nfor~c~!"".jo!(["echo ~'sa y~''%s'''^n"%l~for~l~!#{E[d[d["eval$s=%q(#$s)",?'],?']]}.split("^ n")]):Z('r=fput(char(%d))'
%ord(c))`nZ('end^n")')#),6){"Z f#{d[$S,?%]};"}}}"],?']}').",B]}){9~7{exch~dup~1~and~79~mul~32~ ad d~exch~2~idiv~3~1~roll~s~exch~2~!dex~exch~put~1~sub~dup~6~eq{1~sub}if}repeat~s~ =~pop~pop}forall~=~quit"]+
R}}"]]})*3;echo"^x89PNG^r^n^ x1a^n";$m="";$t="^xc0^0^xff";for($i=-1;++$i<128*$z;$m.=$c--?($w-$c| |$i>$z )&&$i/$z<($c<$w?ord($s[(!t)($c/3)]):$c--%3+2)?$t[2].$t[$c%3%2]. $t[$c%3]:"^0^0^0":"^0")$c
=$i%$z;foreach(array("I`x48 DR".pack("NNCV",$w+2,128,8,2),"IDAT".gzcompress($m),"IEND")as$d)echo~p ack("NA*N",strlen($d)-4,$d,crc32($d));).K(B,"`x7f") ,?']}';s:g/^x7f/Y/;Z~$_"
,128..287];s="$_='#{Q[s,c= /['Y]/]}';$n=32;$s='#{Q[v,c]}';$s=`x7es{..}{$a=$&;$b=chr(--$n&255);`x7es /$b/$a/g;}eg;Z";(s+N*(-s.size%6)).unpack("B*") [0].K(/.{6}/){n=$&.to_i~
2;((n+14)/26*6+n+47).chr} }";s|.|$n=ord$&;substr~unpack(B8,chr$n-!t($n/32)*6-41),2|eg;eval~pack'B*',$ _).scan(/[~,-:A-z]+|(.)/){p="s++#{$1?"chr ~#{$1.ord}+e":$&+?+};"+p
};p),1){"'#$s',"}}'')end. ".K(/[:;()]/){?`x5e+$&}}]"]};quit"]};t=num2cell(b=11-ceil(s/13));for~n=1:9m= {};for~i=1:141f=@(x,y,n)repmat(['Ook' ~char(x)~'~Ook'~char(y)~
'~'],[1~abs(n)]);m(i)=[f (z=46,63,n)~f(q=z-(i<13)*13,q,i-13)~f(33,z,1)~f(63,z,n)];end;t(x)=m(diff([0~s(x =b==n)])+13);end;Zf('%%s',t{:})"]] +R}}"]]}`n"]};"]}`x60`n
~global~_start`n~_start: mov~edx,#{s.size}`n~mov~ecx,m`n~mov~ebx,1`n~mov~eax,4`n~!t~128`n~mov~ebx,0`n~mov ~eax,1`n~!t~128`nx:~|`n~}}{{{qr }}}"]}"call~void~[mscor
lib]#{C*"::"}(sJ)ret})] }];"]};quit();",?$].K(?'){"'^''"}}'"}@>)`np"],?&,?&]},'&(%d+)&',function(s)return~ sJ.rep('Y',tonumber(s))end) ;Z(x)".K(/[:"]/,":^0")}
"`n`x4bT`x48`x58B`x59E~ B`x59E)).size+1}x~i8]c"#{s.K(/[^"`n`t]/){"^%02`x58"%$&.ord}}^00"declare~i32@puts(i8 *)def!e~i32@mX{%1=call~i 32@puts(i8*getelementptr
([#{i}x~i8],[#{i}x~i8]* @s,i32~0,i32~0))ret~i32~0})],?#]]]}""")).K(?',%('"'"'))}';for((i=0;i<${#t};i+=99)) ; do;x=${t:$i:99};a~"^" ${x//[Y^`"]/Y^0}^".Z;"~1
0;done;a~");";p(){~echo ~-n~$1;};f(){~for~x~!~${s[*]};do;p~$3;for((j=$2;j--;));do;h~$1~$x~$j;done;done;} ;p ~k^`x60;h( ){~p ~^`x60${1:$(($2>>$ 3&1)):2};};f~kki~7~'`x60
`x60s`x60`x60s`x60`x60s `x60`x60s`x60`x60s`x60`x60s`x60`x60s`x60`x60si';s=();a~'AG-`x48-`x48Fy.IlD==;=j d lAy=;=jldltld ltl{lAulAy= jtlldlAyFy=?=jd lAyGFyFyG2AFy>zlAFFBCjldG
yGFy>GFy.AGy=G==n`x48==n lldC=j@=jtlldltldlAut11';h(){~p~${1:$(((($2%83-10)>>((2-$3)*2))%4)):1};};f~sk i ^`x60~3)]})A+= "'+`x21[]+'"+G .char CodeAt(E).to SJ(16);for(A+="^".replace
(/'+`x21[]+'/g,^"%^")))' )()",R=0;R<9;R++)A=A.replace(/'.*?'/g,function(B){T=[];for(E=1;B[E+1];)T.p us h(P[B[E++]]);return~T.jo!('+')} );console.lo g('"'+A+' "'))).bytes{|n|r,z=z[n]||(
b[r/78];b[r];q<6083&&z[n] =[q+=1,[]];t[n])};b[r/78];b[r]}";!t~i=0,n=0,q=0;for(;++n<126;)c[n]=""+(c har) n;for(;i<#{a.size};){q=q*78+(s.c harAt(i)-13)%84; if(i++ %2>0){y=q<n?c[q]:y;c[n++]=z
+y.charAt(0);System.out.Z( z=c[q]);q=0;}}}})]}"`n!vokevirtual~#$T/Zln(L#{S}J;)V`nreturn`n.end~me thod)+N] };H("DO,1<-#"||*s);s?while~t:=or d(move(1))do{i+:=1; u:= -i;every~0to~7do{u:=u*2+t%2;
t/:=2};H("PLEASE")^(i%4/3) ;H("DO,1SUB#"||i||"<-#"||((c-u)%256));c:=u;};H("PLEASEREADOUT,1^nP LEASEGIVEU P");end)]};}}"].tr(?"+B,"`x21`x7e")}'.tr('`x7e`x21', ' YY^u0022')as~byte[]);z.close(
)"`n)]}"{"W""w"@j~1+:j^-~11 8%1+*}%"/35512416612G61913@921/17A331513"t)]};})],B]}`n.endtemp late",61){"Zn# $S`n"},?%]]}"`nquit)]});CloseStream(s);QUIT;"]}") ]}"~DUP~A~."~DO~10~I=1,"~.~CR~
S"~&A,&"~C~."~10~~~~~~CONTIN UE"~CR~S^"~&A)^",&"~C~0~DO~B~."~&char("~COUNT~.~."~),&'"~CR~ LOOP~S^"~&^"^""~C~ S"~end~#$D"~C~A~."~STOP"~CR~A~."~END"~CR~B`x5 9E~;~D~),B],?`x21].K(?',%('"'"')
)}'"]};}".K(?"){'"34,"'}.K(N){ '"10,"'}+?",?%]+'~""")'],?`x7e]}."]}"))],15){"f(#{V[$S[ 1..-2],'",',');f("']} ,0);"}}}})}]pq"]}");})}`x60);}"]]}"))]. K(?`x60,"Yx60"),'#{f(',')}']})"]}
"))["~~~~^"~^".""STOP~RUN."])]( Zln(str"message(STATUS~^"~~~~~"(.replace(.replace(s tr~s)"Y""YY")"^"""Y^"")" ^")")))).reverse]})#$C($"Put~ca ffe!e~{(!t)c}~!to#$F.^n");#$C("Liqu
ify#$G.^nPour#$G~!to~the~bak!g~di sh.^n^nServes~1.^n");}})]};}/****//****/";t={ };b="";L="";n=i=0;D=->n{L<<( n+62)%92+35;D};s.b ytes{|c|n>0?n-=1:(t[c]=(t[c]||[]).rej
ect{|j|j<i-3560};x=[];t[c].map{|j|k =(0..90).f!d{|k|not~s[i+1+k]==s[j+k]}|| 91;k>4&&x<<[k,j]};x=x.max)?(n,j=x; x=b.size;(u=[x,3999].m!;D[u%87][u/87];L
<<b[0,u];b[0,u]="";x-=u)while~x>0;x=4 001+i-j;D[x%87][x/87][n-5]):b< <c;t[c]+=[i+=1]};"#!clude<stdio.h>`nch ar*p=#{E[L]},s[999999],*q=s;!t~mX{!t~n,m;
for(;*p;){n=(*p-5)%92+(p[1]-5)%92*87;p+ =2;if(n>3999)fo r(m=(*p++-5)%92+6;m--;q++)*q=q[4000-n];else~ for(;n--;)*q++=*p++;}puts(s)#{R}}")]}){s+="0
0g,";for(m=1;m<256;m*=2)s+="00g,4,:"+(c/m% 2>0?"4+":"")+",";f(s);s="4,:,";}f(s+s);for(c:Base6 4.getDecoder().decode("kaARERE`x58/I0ALn3n5ef6l
/Pz8+fnz58/BOf5/7/hE`x58/O`x5azM5mC`x58/Oczm` x5azBPn5+`x58/OczMznBL/nM5m`x5azBPu++fPPOc5zngnnO`x5azO`x 5agnBMGAW7A==")){c=c<0?256+c:c;for(i=0;i++<3;c/=8)f
(c%8);f("8*+8*+,");}f("@");).K(?',%('"'"'))}'|sed~ -e's/Y/YY/g'~-e's/"/Yq/g'~-e's/.*/Z~"&"^nquit/')]}}"]],?']}');".K (/^+/){"`x5e#{$&.size}`x5e"}]}.split("Y`x5e");for(!t~i=
1;i<a.length;a[0]+=a[i+1],i+=2){a[0]+="Y".repeat(Integer .parseInt(a[i]));}System.out.Z(a[0]);}})]]};}";FORiTO`~UPBtDO`~INTn:=ABSt[i];Z( ~(50+n%64)+c+~(50+n%8MOD8)+c+~(50+nMOD8)+b+"`x4a"+a)OD]*"REPR"
]}"`ntrans~c~0`ndo{D(Integer(S:get~c))`nf~35~39}(<(c:++)(S:length))`nf~24~149)].K(N,'"&Character'+?'+'Val(10)&"')}");end;)]+"`nsys.exit~0",B],?']}'",/[^{}]/]}}",35){y<<",`n"+$S;"%s"}}")+y],'",','):f("']}",0))}]]></#{U}></xsl:#{I}>"].K~N,'"&~VbLf~&
"'}":s="~~~":For~i=0To~7:s~&=Chr(32-(Asc(c)>>7-i~And~1)*23):Next:#$C(s~&n~&Chr(9)&n~&"~~"):Next:#$C(n~&n~&n):End~Sub:End~Module)]}`nput=s`nZ`nqa`x21",3){%($H("%s",#$S);)+N}}end~endmodule);W=s.size*72+4;"%d,%d"%[W/65536,W%65536]}});foreach(!t~c~!#{
E[s]}.data)foreach(!t~v~!~a={0,9,7,4,5,c/100*7/6+1,c%100/10*7/6+1,c%10*7/6+1,7})p({144,v=15450+v*256,384,v});p({255,12032});})]},i=0,t='k';while(s[i])t='^x60.'+s[i++]+t;console.log(t)",B],?`x21].K(?',%('"'"'))}'"^n::=^na")],/[`[`]$]/]}")]};Z"0~0~-
1";)],?']}';cr",127..255];%(variable~s=`x60#{s.K(/.{1,234}/){$&+"`x60+`n`x60"}}`x60,i;for(i=0;i<129;i++)s=strreplace(s,pack(`x60C`x60,255-i),substrbytes(`x60#{v[0,99]}`x60+`n`x60#{v[99..-1]}`x60,i*2+1,2));Zf(`x60%s`x60,s)).reverse.unpack1("`x48*")
}"16))(display"^n#[Exeunt]")),196){%(Z#$S;)}}}"]});})).gsub(/[!HJKXYZ^`~]/){[B*2,:write,B,:tring,:gsub,"ain()",B*4,:print,g,:in][$&.ord%47%12]})))*"")#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffe
#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffe
#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffe
#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffe
#################################################################################### Quine Relay -- Copyright (c) 2013, 2014 Yusuke Endoh (@mametter), @hirekoke ###################################################################################)