Skip to content

Instantly share code, notes, and snippets.

@itamarhaber
Last active December 21, 2017 14:38
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 itamarhaber/2d9e3fce3eb660d47d9aa8f5718b3b61 to your computer and use it in GitHub Desktop.
Save itamarhaber/2d9e3fce3eb660d47d9aa8f5718b3b61 to your computer and use it in GitHub Desktop.
Happy Xmas!
local
h,d,r=9,
0,{} while
h>0 do local
l='' h=h-1 for
x=0, 38 do local
a=x-6 if a<0 then a
= -a end if a <= d then
l = l .. '*' elseif (0.3/
(h+1)) > math.random() then
l=l..'.' else l=l..' ' end end d=
d+1 table.insert(r, l) end return r

Happy Xmas!

A Redis Lua port of https://gist.github.com/antirez/2298640095f972d1a6d0

$ export SHA1=`redis-cli SCRIPT LOAD "$(cat xmas.lua)"`
$ redis-cli --raw EVALSHA $SHA1 0
      *                              .
     ***
    *****            .
   *******      .     .
  *********
 ***********   .          .  . ..
*************                    .
**************                   .    .
***************. . .     ..   .    ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment