Skip to content

Instantly share code, notes, and snippets.

@gildor
Created July 16, 2013 09:38
Show Gist options
  • Save gildor/6007281 to your computer and use it in GitHub Desktop.
Save gildor/6007281 to your computer and use it in GitHub Desktop.
eval$s=%q(eval(%w(B=92.chr;N=10.chr;n=0;e=->(s){s.gsub(/[#{B+B+N}"]/){B+(N==$&??n:$&)}};E=->(s){'("'+e[s]+'")'}
;d=->(s,t=?"){s.gsub(t){t+t}};D=->(s,t=?@){s.gsub(B){t}};Q=->(s,t=?$){s.gsub(t){B+$&}};puts(eval(%q("objectXQRX
extendsXApp{Hln#{E[%((displayX"#{e[%(HfX% sX"#{Q[ e["Trans criptXshow:X'#{d[%(putsX[regsubX-allX{.}X"#{Q[e[%[
intXK(){sJXs=#{E[%(withXAda.Text _Io;p roce dure XQRXisXbeginXAda.Text_Io.Put_Line("#{d[%(BEGINXH("#
{d[%(BEGIN{s=#{E[D[%(forXbXinX Sys t em.Text.ASCIIEncoding().GetBytes(#{Q[E["#i
nclude<stdio.h>`nintXK (){pu t s#{E["#include<iostream>`nintXK(){std::cout
<<#{E[%(classXProgram {pu blicXstaticXvoidXMain(){System.Co
nsole.Write(#{E[D[%( ( defnXf[lXr](if(>(countXr)45)(lazy-
seq(cons(str"XXXX^" "r"^"&")(fXl"")))(let[c(fir
stXl)](ifXc(f(next Xl)(if(=XcX^")(strXrXcXc)(st
rXrXc)))[(str"XXX X^""r"^".")]))))(doall(
mapX#(Hln(str"XX XXXXXX"%1))(lazy-cat["ID
ENTIFICATIONXD IVISION." "PROGRAM-ID.XQR.""PR
OCEDUREXDIVI SION."]#{%(s=#{E[%(packag eXK;import("fmt";"sJs
");funcXK() {fmt.Print("H^x27"+sJs.Replace("#{ e[D[e[%(importXData.
Char`nK=p utStrLn$"procedureXK();write(^"DO,1<-#"++ show(lengthXs)++fX
sX1X0;f( x:t)iXc=letXv=foldl(^aXx->a*2+(modXxX2))0$take X8$iterate(flipXd
ivX2)$D ata.Char.ordXxXin(ifXmodXiX4<1then"PLEASE"else"")+ +"DO,1SUB#"++sho
wXi++" <-#"++show(mod(c-v)256)++"^^n"++fXt(i+1)v;f[]_X_="PLE ASEREADOUT,1^^n
PLEAS EGIVEUP^");end";s=#{E[%(.classXpublicXQR`n.superXjava/la ng/Object`n.me
thod XpublicXstaticXK([Lj ava/lang/SJ;)V`n.limitXstackX2`ngetsta ticXjava/lang/
Syst em/outXLjava/io/Prin tStream;`nldcX"#{e[%(classXQR{publicXst aticXvoidXK(S
J[] v){SJXc[]=newXSJ[800 0 ],y="",z=y,s="#{z=t=(0..r=q=126).map{|n |[n,[]]};a=[
];% (@s=internalXconstan t[# {i=(s=%(PRINTX"#{Q["H"+E[%(all:`n`t@Hf X%sX"#{e[%(.
ass em blyXt{}.methodXstati cXvoi dXMain(){.entrypointXldstr"#{e["varXu= require('ut
il' );u.H('#import<stdio .h>^n') ;u.H(#{E[D[%(intXK(){puts#{E["H_sJ"+E[ "Hf"+E[%(sa
y"#{ e["progr amXQR(output);beginX#{([* %($_="#{s=%
(<?ph pXe cho"#{Q[e[ "intXK( ){write#{E["q r:-writ e('#{Q[e["H"+E["cat"+E[%(ev al$s=%q(#$s
)).gsu b(/.+/){"sayX`"# {d[$& ]}`""}]]],?']}' ),nl, halt."]};returnX0;}"]]}"?>); (s+N*(-s.si
ze%6)).by tes.map{|n|"%07b"% n}. join.scan(/.{6}/) .ma p{|n|n=n.to_i(2);((n/26*6+n+1 9)%83+46).c
hr}*""}";s|.|$n =ord$&;substrXu n pack(B8,chr$n-($n<5 8 ?-6:$n<91?65:71)),2|eg;s/.{7}/ 0$&/g;HXpac
kXB.length,$_). scan(%r(([X.0-9A -Za-z]+)|(.))).revers e.map{|a,b|(b)?"s//chrX#{b.ord} /e":"s//#{a
}/"},"eval"]*"X xX").scan(/.{1, 2 55}/).map{|s|"write ( '#{s}');"}*""}end."]}"`n e nd`n)]]]};r
eturnX0;})]]}.r eplace(/@/g,S J.f romCharCode(92))) "]} "callXvoidX[ m s corlib]Sy
stem.Console::Wr iteLine(sJ)r et})] }")],/[X^`t;"() {}`[` ]]/]}`nB Y E )).size+
1}XxXi8]c"#{s.gs ub(/[^`n"] /){B+"% 02`x58"%$&.or d}}^00" declareXi32@pu t s (i8*)de
fineXi32@K(){star t:%0=call Xi32@puts(i8 * X getele
mentptrXinbounds( [#{i}XxXi8]*@s,i32X0, i32X0)) retXi32X0}).bytes{|n|r,z= z[n]||(a < < r;q<56
24&&z[n]=[q+=1,[]] ;t[n])};a<<r;t=[*43.. 123]- [64,*92..96];a.map{|n|t[n/75].chr+ t [ n%75]
.chr}*""}";intXi,n, q=0,t;for(n=0;++n<126 ;)c [n]=""+(char)n;for(i=0;++i<s.length( ) ;){t=
s.charAt(i);q=q*75+t -t/64-t/92*5-43;if(i% 2 >0){y=q<n?c[q]:y;c[n++]=z+=y.charAt( 0 );Sys
tem.out.H(z=c[q]);q=0 ;}}}})]}"`ninvokevir tualXjava/io/PrintStream/Hln(Ljava/ l ang/
SJ;)V`nreturn`n.endXme thod)+N]})]]]}^x27^n ","@","^^",-1))})]};u="XXXXXXXX";g= ( l)->
l.replaceX/[^^"]/g,(x)- >"^^"+x`nf=(l)->console.logX"(write-lineX^""+g(l)+"^ ")"`ne= (l)-
>fX".^^^""+u+g(l)+"^"Xcr" `nd=(l)->eX"WRITE(*,*)'"+u+l+"'"`ndX"programXQR" ;dX"HX^"( &";i
=0`ndX"&A,&"whileXi++<s.le ngth`ndX"&A)^",&";i=0`ndX"&char("+s.charCo deAt(i++)+"),&"whil eXi<
s.length`ndX"&^"^"";dX"endXp rogramXQR";eX"STOP";eX"END";fX"bye") .gsub(/.+/){%((cons"DI SPL
AY"(f"#{e[$&]}""")))}}["STOPXRU N."])))),?~]]}.Replace("~"," ^^"));}})]};}"]};returnX 0;}
"]]}):HXjoin(['+'forXiXinXrange(0 ,b)],"")+".>" ),?!]]};gsub(/!/,"^^",s);HXs})]}
")END)]}");endXQR;)]};intXi,j;H("modu leXQR;initialXbeginX");for(i=0;i<s.
length;i++){H("$write(^"XXX");for(j=6;j>= 0;j--)H((s[i]>>j)%2>0?"^^t":"X");H("^^n^
^t^^nXX^`");");}H("$display(^"^^n^^n^");endXendm odule");returnX0;}].reverse],/[`[`]$]/]}"X^x60.
&];putsX"k"),?']}';cr"]]}")]}"))]}}").gsub(/[HJK^`X]/){[:print,0,:tring,:main,B*2,0,B,32.chr][$&.ord%9]})))*"")
################### Quine Relay -- Copyright (c) 2013 Yusuke Endoh (@mametter), @hirekoke ##################)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment