Created
November 15, 2016 07:09
-
-
Save Shujito/50125998b0fc397b4917abf4ce1dba8a to your computer and use it in GitHub Desktop.
Revisions
-
Shujito created this gist
Nov 15, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ local fiveChars = ... or 'weiss' --print('chars:', fiveChars:lower()) local function bitSet(number, offset) local nro = bit32.rshift(number, offset) local nroa1 = bit32.band(nro, 1) --print('nroa1', nroa1) return nroa1 ~= 0 end print('<!doctype html>') print('<html>') print(' <head>') print(' <title>Imgurer - ' .. fiveChars .. '</title>') print(' <head>') print(' <body>') for idx=1,2 ^ fiveChars:len() do -- print('idx', idx) local permutation = '' for jdx=1,fiveChars:len() do local currentChar = fiveChars:sub(jdx,jdx) --print('current:', currentChar) if bitSet(idx - 1, jdx - 1) then --print('has bit') permutation = permutation .. currentChar:upper() else --print('lacks bit') permutation = permutation .. currentChar:lower() end end --print('permutation #'..idx, permutation) print(' <a href="https://imgur.com/'.. permutation ..'">') print(' <img width="320px" src="https://i.imgur.com/' .. permutation .. 'm.jpg"/>') print(' </a>') end print(' <body/>') print('<html/>')