commit ba520da43e4d596b08317316e0bbf58ceec6f729 Author: nein.wtf Date: Thu Feb 17 14:43:24 2022 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1915e12 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +covid_deaths.csv +covid_deaths.db +covid_deaths.db-shm +covid_deaths.db-wal diff --git a/README.org b/README.org new file mode 100644 index 0000000..cc92e69 --- /dev/null +++ b/README.org @@ -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. diff --git a/index.lua b/index.lua new file mode 100644 index 0000000..c57409e --- /dev/null +++ b/index.lua @@ -0,0 +1,47 @@ +sqlite3 = require "lsqlite3" +db = sqlite3.open('covid_deaths.db') + +Write([[ + + + + + Covid Deaths + + + + +]]) + +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('') +for i=1,rows[1]["sum_deaths"] do + Write('🖤') + if i > 0 and i < rows[1]["sum_deaths"] and i % 100 == 0 then + Write('') + end +end +Write('') + +Write([[ + + +]]) diff --git a/redbean.com b/redbean.com new file mode 100755 index 0000000..6c0a55d Binary files /dev/null and b/redbean.com differ diff --git a/sqlite3.com b/sqlite3.com new file mode 100755 index 0000000..61647f0 Binary files /dev/null and b/sqlite3.com differ diff --git a/update-data.sh b/update-data.sh new file mode 100755 index 0000000..d4d2aba --- /dev/null +++ b/update-data.sh @@ -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 )'