Skip to content

Instantly share code, notes, and snippets.

@tompng
Last active December 18, 2019 16:36
Show Gist options
  • Save tompng/f66e7e6d631a400be3cc5cff44b72616 to your computer and use it in GitHub Desktop.
Save tompng/f66e7e6d631a400be3cc5cff44b72616 to your computer and use it in GitHub Desktop.
57577 quine
##5## ###7### ##5## ###7### ###7###
!eval s="$><< '!%sl s=%%p'% :eva%s"
code = File.read(__FILE__).lines[1].strip
File.write 'tmp.rb', code
out = `ruby tmp.rb`
counts = code.split.map(&:size)
puts
p out == code
p counts
raise unless out == code && counts == [5,7,5,7,7]
__END__
#
# x="x= %p;$><< x%%x"; $><< x%x
# x= "x= %p;$><< x%%x";$><< x%x
#
#
# x="=%p;$><<?x+x%%x";$><<?x+x%x
# x="=%p;$><<?x+x%%x";$><<?x+x%x
#
#
# x=%(x=%%(%s);$><<x%%x);$><<x%x
# x=%(x=%%(%s);$><<x%%x);$><<x%x
eval( s="$><< 'ev'+ +++'al( s=%p)'%s")
eval( s="$><< 'ev'+ +++'al( s=%p)'%s")
eval( s="$><< 'eva' '''''l( s=%p)'%s")
eval( s="$><< 'ev'+ +++'al( s=%p)'%s")
##5## ###7### ##5## ###7### ###7###8
;eval s="$><< ';%sl s=%%p'% 'eva'%s"
;eval s="$><< ';%sl s=%%p'% 'eva'%s"
;eval s="$><< ';%sl s=%p'%[ :eva,s]"
;eval s="$><< ';%sl s=%p'%[ :eva,s]"
;eval s="$><< ';%sl s=%p'%[ :eva,s]"
;eval s="$><< ';%sl s=%p'%[ :eva,s]"
eval( s="$><< 'eva' 'l(%cs= %p)'%s")
eval( s="t=+' s=%p' %s;$><< 'eval(+t+)'")
eval( s="puts 'eva' 'l(\x20 s=%p)'%s")
eval( s="puts 'eva' 'l(%s=%p)'%[' s',s]")
eval( s=%(puts 'eva' 'l( s=%('+s +'))'))
eval( s="puts 'eva' 'l(s=%('+s+'))'")
eval (s= %(puts 'eva' %(l(s=\#{s}))))
eval(s="$><< 'eva' 'l(s=%p )'%s" )
x
=%(x
=%%(%s)
$><<
x%%x)
$><<
x%x
12345 1234567 12345 1234567
;x=?'+ "x=?'+ =+ ++ %p; $>.<< x%%x"; $>.<< x%x
s="s=%p;puts(s%%s)";puts(s%s)
(s="")=~//;eval s
eval(s="$><< 'eva' 'l(s=%p )'%s" )
s="$><<'s=%p;eval(s)'%s"; eval(s)
s="$><<'s=%p; ev' 'al(s' ')'%s"; eval(s)
s="$> <<'s=%p; ev' 'al(s' ')'%s"; eval(s)
s=%($><<%(s=%(#{s});eval(s))); eval(s)
s=%($><<"s=%("+s+");eval(s)");eval(s)
s=%($><<"s=%("+s+");eval(s)");eval(s)
5555577777775555577777777777777
eval(s=%($><<"eval(s=%("+s+"))"))
eval( s=%($>. <<"ev al(s=%( "+s+"))"))
$>.<< %(
$>.<< %(
)*2,2
$>.<< <<22,2
222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment