Skip to content

Instantly share code, notes, and snippets.

@tompng
Created April 29, 2019 09:14
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tompng/5cb316a8bb99871dcc903cdf7a7e2114 to your computer and use it in GitHub Desktop.
y=201904;eval(c=(%w(c=("y=#{y^1};eva
l(c=(%w(#{c})*'').gsub(/#{92.chr}x1B
.7?m/,''))").chars;370.times{|i|x=27
.chr;$><<(i%37==36?$/:[x+"[7m%s"+x+"
[m",'%s']['t97hors0ui06fp5kk6ug8vdyd
oklqdkjbg8mtphndhtu3q9c31wxne49wpe6m
rkconuqfjo85ezlffy7zga7m6eagpkyij5bf
cfg9yn1jb8vyynfkv2y3noz9jc4f1t3lkf17
ehg3nk0pa7'.to_i(36)[(y&1)*370+i]]%[
c.shift])})*'').gsub(/\x1B.7?m/,''))
require 'pry'
texts = File.read('template.txt').split("\n\n")
shapes = texts.map { |t| t.split "\n" }
shapes.each do |s|
len = s.map(&:size).max
s.map! { |l| l + ' ' * (len - l.size) }
end
shapes.each do |shape|
shape.map! { |s| " #{s} ".gsub(/./) { |c| '# '[c.ord & 1] } }
l = '#' * shape[0].size
shape.push l
shape.unshift l
end
h = shapes[0].size
w = shapes[0][0].size
nums = shapes.map{|s|s.join(' ').gsub(/./){|a|a==' ' ? 0 : 1}.reverse.to_i(2)}
shifts = w * h + h
num = (nums[1] + (nums[0]<<shifts)).to_s(36)
code = DATA.read.gsub(/EMBED\{([^}]+)\}/) { eval $1 }
puts code
__END__
y=201904;eval(c=(%w(
c=("y=#{y^1};eval(c=(%w(#{c})*'').gsub(/#{92.chr}x1B.7?m/,''))").chars;
EMBED{h*(w+1)}.times{|i|x=27.chr;
$><<(i%EMBED{w+1}==EMBED{w}?$/:
[x+"[7m%s"+x+"[m",'%s']['EMBED{num}'.to_i(36)[(y&1)*EMBED{shifts}+i]]%[c.shift])
}
)*'').gsub(/\x1B.7?m/,'').delete(" \n"))
y=201905;eval(c=(%w(c=("y=#{y^1};eva
l(c=(%w(#{c})*'').gsub(/#{92.chr}x1B
.7?m/,''))").chars;370.times{|i|x=27
.chr;$><<(i%37==36?$/:[x+"[7m%s"+x+"
[m",'%s']['t97hors0ui06fp5kk6ug8vdyd
oklqdkjbg8mtphndhtu3q9c31wxne49wpe6m
rkconuqfjo85ezlffy7zga7m6eagpkyij5bf
cfg9yn1jb8vyynfkv2y3noz9jc4f1t3lkf17
ehg3nk0pa7'.to_i(36)[(y&1)*370+i]]%[
c.shift])})*'').gsub(/\x1B.7?m/,''))
########### # #
# # # # #
# # # #############
# # # # #
############### #### # #
# # # ##
# # # ## #
# # ## ## ##
## ###
# # ###
###### # #####
## ## ####### # #
### ####### ### ### # #
# # # # ## # #
# ## # # #####
# #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment