Skip to content

Instantly share code, notes, and snippets.

@tompng
Created January 31, 2020 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tompng/d79e12f3d056cf12c1448a097035bdf3 to your computer and use it in GitHub Desktop.
Save tompng/d79e12f3d056cf12c1448a097035bdf3 to your computer and use it in GitHub Desktop.
c=%w()*'';eval(c)
code=<<CODE
n=0;
c='c=%w('+c.sub(/[0-9]/,((n+1)%7).to_s).split(f=?#+?;)[0]+f+c.delete('()');
d=(0..19).map{|y|
(0..27).map{|x|
(32.chr+?#)[
'1zafcwugrqlbgca9ooyr858xb34mju9nuvjlz7a61qkek0xi'.to_i(36)[
35*n+y/4*7+x/4
]
]
}*''
}*$/;
e=(c[0,d.count(?#)-12]+")*'';eval(c)").chars;
puts(d.gsub(?#){e.shift})
CODE
# s= DATA.read.delete(" \n").tr('-#','01').reverse.to_i(2).to_s(36)
# puts '#' + s
# puts (35*7).times.map{|i|s.to_i(36)[i]}.each_slice(7).map(&:join)
c=code.delete(" \n")
eval c
__END__
-##-##-
#######
-##-##-
#######
-##-##-
-#####-
##---##
##---##
##---##
-#####-
#######
##-----
#######
##-----
#######
######-
##---##
##---##
##---##
######-
-#####-
##---##
##---##
##---##
-#####-
-#####-
##--###
##-#-##
###--##
-#####-
-#####-
##---##
-#####-
##---##
-#####-
c=%w(n=1 ;c='c=%w
('+c.sub (/[0-9]/
,((n+1)% 7).to_s)
.split(f =?#+?;)[
0]+f+c.delete('()');d=(0..19
).map{|y|(0..27).map{|x|(32.
chr+?#)['1zafcwugrqlbgca9ooy
r858xb34mju9nuvjlz7a61qkek0x
i'.to_i( 36)[35*n
+y/4*7+x /4]]}*''
}*$/;e=( c[0,d.co
unt(?#)- 12]+")*'
';eval(c)").chars;puts(d.gsu
b(?#){e.shift})#;n=0;c='c=%w
'+c.sub/[0-9]/,n+1%7.to_s.sp
litf=?#+?;[0]+f+c.delete'';d
=0..19.m ap{|y|0.
.27.map{ |x|32.ch
r+?#['1z afcwugrq
lbgc)*'' ;eval(c)
code = `ruby hashtag_generator.rb`
File.write 'output.rb', code
code2 = `ruby output.rb#{'|ruby'*7}`
puts code==code2
puts code2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment