Initial commit

main
nein.wtf 2022-02-17 14:43:24 +01:00
commit ba520da43e
6 changed files with 85 additions and 0 deletions

4
.gitignore vendored 100644
View File

@ -0,0 +1,4 @@
covid_deaths.csv
covid_deaths.db
covid_deaths.db-shm
covid_deaths.db-wal

24
README.org 100644
View File

@ -0,0 +1,24 @@
#+TITLE: Readme
* Rough Concept
Fuck this. Millions of people have died of COVID and probably there are millions more to come. Instead of a coordinated effort of keeping the global suffering as small as possible, most of the energy goes towards squeezing the last bit out of collective organization so that already powerful countries can be kept running and get an edge in the post-pandemic economic recovery. Early pandemic hopes that it could lead to a significant and lasting disruption of business-as-usual seem infinitely far away while the abolition of health protective measures is discussed even in regions with hundreds or thousands of people suffering and dying each day.
* What this is about
This project is first and formost about giving the collective experience of loss a space. It tweets one 🖤 per dead person, until every single dead person has at least been given the little bit of honor this can provide.
* How does it work
In regular intervals, this fetches the current covid data from https://covid-19.datasettes.com, which provides data by the Johns Hopkins university, using the following query:
#+begin_src sql
select day, last_update, sum(deaths) sum_deaths
from johns_hopkins_csse_daily_reports
where country_or_region not like '%Olympics%'
group by day
order by day desc
limit 1
#+end_src
This provides an up-to-date approximation of total covid 19 deaths. Tweets are sent as often as the Twitter API allows.

47
index.lua 100644
View 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>
]])

BIN
redbean.com 100755

Binary file not shown.

BIN
sqlite3.com 100755

Binary file not shown.

10
update-data.sh 100755
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -ex
curl 'https://covid-19.datasettes.com/covid.csv?sql=select+day%2C+last_update%2C+sum(deaths)+sum_deaths%0D%0Afrom+johns_hopkins_csse_daily_reports%0D%0Awhere+country_or_region+not+like+%27%25Olympics%25%27%0D%0Agroup+by+day%0D%0Aorder+by+day+desc%0D%0Alimit+7%0D%0A&_header=off' > covid_deaths.csv && \
./sqlite3.com covid_deaths.db \
'pragma journal_mode = "wal"' \
'create table if not exists covid_deaths(day text, last_update text, sum_deaths integer)' \
'.mode csv' \
'.import covid_deaths.csv covid_deaths' \
'delete from covid_deaths where rowid not in ( select max(rowid) from covid_deaths group by day )'