Created
September 19, 2010 05:52
-
-
Save shibason/586451 to your computer and use it in GitHub Desktop.
AA Quine & AA Quine generator (Hatsune Miku)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval$s=%w~ | |
a=->(b,c, d,e,f){%`#{(c)?"re quire'zlib';":' | |
'}g=Marshal.load(#{ (c)?'Z lib::Inflate.infl | |
ate(':''}'#{b}'. unpack('m')[0]#{(c)?')': | |
''});h= 'eval$s =%w'<<126<<($s*#{d} );i=' | |
';j=- 1; #{ e*f}.times{|k|i<< (g[ | |
k]== 1? h[j+=1]:32);i<<10i f | |
(k% #{e} ==#{e-1})};i[-7,6] | |
=' ' < <126<< '.join';puts(i)#`}; | |
$*[ 0]? ( require' RMagick';include(Ma | |
gi ck );l=$*[0];m =($*[1]||80).to_i;n= | |
Qu a ntu mRange*( $*[2]||0.5).to_f;o= | |
Im a g eL ist.new(l ).flatten_images;p= | |
o. c olu mns; q=o.rows;r=->(o){(p | |
> q ) ? o .re size (m ,m*q/p/2):o.resize | |
(m * p / q ,m /2)}; o=( p>m||q>m)?r[o.bile | |
v el_ch an ne l (n )] :r [o].b ile vel_channel(n);e= | |
o. columns ;f= o.r o w s;rais e('INVALID_ IMAGE_DATA')if(e<0||f | |
<0 );s=''; o.ea ch _pixel {|t|s<<((t.red< n)?'1':'0')};s[0,10] | |
='1 '*10;s[ -6,6 ]= '1'*6; u= s.count('1');v=Marshal.dump(s.rev | |
erse.to_i(2 ));r eq u ire'z l ib';w=Z lib::Deflate.deflate(v) | |
;c= v.size> w.siz e+37;b=[(c) ?w:v] .pack('m').tr(10.chr,'');d=u/b. | |
size+1;x=a[b,c,d,e,f]; raise(' INSU FFICIENT_ CAPACITY')if(u<x.size | |
+15);e val($s=x)):eva l(a[' eJ wlkLFL w1AQxr/XlKbQQjpmaiq4u | |
XSz4JD 8KQHXDs4iJOIf0 FmoHZ3 ddJJIoHYodXUMLnVo8Yl | |
gXjHm 81694fhx7+5731 2zPT5S C/ yHDiUZzzDQdIGKAYpSEmo | |
qpGQiVClk5A4IUoW44hqp i6Ft niBT0CIgE3E00I5QiNFoo | |
D1ome12YUIhooXeiCiEH N Ue1o6QiD Xx4FqKcB | |
id9edkNug1ovhiRUbGv x pn ZkrG9bTzm 3FnaabMJ | |
0u ysHRNiYKzg6KT1Lb2y N yt 9zWWrlf/iN4H145vdnt | |
6 9mC9pC+cyILyCjLwrHvK L vY Qi5DWdwNYJsSr1IGt5H | |
faa2z2ffY4my3xbX96KkGcW0f3d Cq ccC2 dQ cukN8yT6tLr | |
mm xJJ1 jlbttEc6p+fer4On6juuXxna+HBVX+lW hf/wF n292 m',true, | |
4 ,80, 40])#a=->(b ,c,d,e,f){%`#{(c)?"requ ir e'zlib';":' '}g=Ma | |
rs hal .load(#{(c) ?'Zlib::Inflate.infl ate(' :' '}'#{ | |
b} '.u npack('m')[ 0]#{(c)?' )':''}) ;h='e va l$s=% | |
w' << 126<<($s*#{d });i= ''; j=-1 ;#{e* f }.tim | |
e s{ |k|i<<(g[k] ==1? h[j+=1]:3 2) ;i << 10if | |
(k % #{e}==#{e-1} )} ; i[-7,6]=''<< 12 6< < '. join | |
'; puts(i)#`};$ *[ 0]?( require'RMa gick '; ~.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment