Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#!/usr/bin/env lua50
-- sshot-uniq.lua
-- By Edrx, 2006oct02
-- sshot.el sometimes creates repeated screenshots.
-- This script cleans them.
-- See: (find-angg ".emacs" "sshot")
--      (find-angg "elisp/sshot.el")

stem = arg[1]
pngs = split(getoutput("ls " .. stem .. "_*.png | sort"))
newpngs = {}
commands = {}

for n,name in ipairs(pngs) do
  local newn = getn(newpngs) + 1
  local newname = format("%s_%03d.png", stem, newn)
  local prevname = pngs[n-1]
  if prevname and readfile(prevname) == readfile(name) then
    tinsert(commands, format("rm -v %s", prevname))
  else
    tinsert(newpngs, newname)
    tinsert(commands, format("%smv -iv %s %s",
			     name == newname and "# " or "",
			     name, newname))
  end
end


basename = function (str)
    local _, __, bname = strfind(str, "([^/]*)$")
    return bname
  end

dirname = function (str)
    local _, __, dname = strfind(str, "^(.*)/[^/]*$")
    return dname or "."
  end

print "(find-sh \""
print(concat(commands, "\n"))
print "\")"

print(format("(find-fline \"%s/\" \"%s\")", dirname(stem), basename(stem)))
print(format("(setq sshot-next %d)", getn(newpngs) + 1))
print(format("(setq sshot-fname-prefix \"%s\")", stem))
print(format("(sshot-write-html)"))
print(format("(find-fline \"%s.html\")", stem))
print(format("(find-sshot \"%s\" 1)", stem))
print(format("file:///%s.html", stem))

-- (find-angg "elisp/sshot.el")


-- PP(pngs)

-- (find-angg "bin/sshot-uniq.lua")
-- (sshot-uniq "/tmp/sshot/ee-glyph")

-- (find-sh "cd /tmp/sshot/; sshot-uniq.lua ee-glyph")
-- (find-sh "cd /tmp/sshot/; sshot-uniq.lua /tmp/sshot/ee-glyph")