Initial commit
This commit is contained in:
commit
ba520da43e
6 changed files with 85 additions and 0 deletions
47
index.lua
Normal file
47
index.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
sqlite3 = require "lsqlite3"
|
||||
db = sqlite3.open('covid_deaths.db')
|
||||
|
||||
Write([[
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Covid Deaths</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⚫</text></svg>">
|
||||
<style>
|
||||
body {
|
||||
padding: 48px;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
span {
|
||||
padding-right: 0.6em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
]])
|
||||
|
||||
local query = [[
|
||||
SELECT day, last_update, sum_deaths
|
||||
FROM covid_deaths
|
||||
ORDER BY day DESC
|
||||
LIMIT 2
|
||||
]]
|
||||
local rows = {}
|
||||
for v in db:nrows(query) do
|
||||
rows[#rows + 1] = v
|
||||
end
|
||||
|
||||
Write('<span>')
|
||||
for i=1,rows[1]["sum_deaths"] do
|
||||
Write('🖤')
|
||||
if i > 0 and i < rows[1]["sum_deaths"] and i % 100 == 0 then
|
||||
Write('</span><span>')
|
||||
end
|
||||
end
|
||||
Write('</span>')
|
||||
|
||||
Write([[
|
||||
</body>
|
||||
</html>
|
||||
]])
|
||||
Loading…
Add table
Add a link
Reference in a new issue