cal by tabasa

#!ruby -n\x0d
def e m,y\x0d
z=y;n=m+1;(z+=n=1)if n>12\x0d
a=Time.gm(z,n)-1\x0d
[a.strftime("%B"),a.day,Time.gm(y,m).wday]\x0d
end\x0d
m,x,f=e(*o=$_.split.map{|i|i.to_i})\x0d
w="#{m} #{o[1]}"\x0d
print((" "*((20-w.size)/2)+w+" "*9)[0,20]+"\nSu Mo Tu We Th Fr Sa\n","   "*f)\x0d
k=0\x0d
x.times{|i|f+=1;printf"%2d#{(f>6||i+1==x)?(f=0;k+=1;'\x0d
'):' '}",i+1}\x0d
puts if k<6

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top