CXXFLAGS += -g -DJSON_DIAGNOSTICS=1
LDFLAGS += -fuse-ld=lld
# git diff ~/lfs.nabijaczleweli.xyz/0017-twitter-export/index.html index.html
# git diff ~/lfs.nabijaczleweli.xyz/0017-twitter-export/stats.html stats.html
# for s in *.svg *.dat gnuplot_svg.js; do git diff ~/lfs.nabijaczleweli.xyz/0017-twitter-export/$s $s; done
#
# mv index.html ~/lfs.nabijaczleweli.xyz/0017-twitter-export
# mv stats.html ~/lfs.nabijaczleweli.xyz/0017-twitter-export
# for s in *.svg *.dat gnuplot_svg.js; do cmp ~/lfs.nabijaczleweli.xyz/0017-twitter-export/$s $s || mv -v $s ~/lfs.nabijaczleweli.xyz/0017-twitter-export; done
all : index.html stats.html
.ONESHELL:
# Expects to link to the hierarchy made by https://github.com/timhutton/twitter-archive-parser as well as the export
# Then, generate and
# grep -e ' index.html
tweet.ids: data/tweets.js
tail -c+27 data/tweets.js | jq -r '.[] | .tweet.id' | grep -vF $(shell awk '/exclude\[\]/,/}/' common.h | grep -F \" | cut -d\" -f2 | sed i-e) | sort -n > tweet.ids
@wc -l tweet.ids
tweets-per-month.svg: stats tweet.ids Makefile
./stats < tweet.ids
for f in *.dat; do
(set -x;
gnuplot -e 'set terminal svg size 1200,400 dynamic mouse; set auto x; set auto y; set key left autotitle columnhead; set xtics nomirror rotate by -90; '"$$(grep '^#:addl' "$$f" | cut -d' ' -f2-)"' plot "'$$f'" using 2:xtic(1) with '"$$({ grep '^#:type' "$$f" || echo lines; } | sed 's/^#:type //')" |
sed -e 's/fill="#ffffff" stroke="black"/fill="none" stroke="none"/' -e 's:/usr/share/gnuplot/gnuplot/[^/]*/js/gnuplot_svg.js:gnuplot_svg.js:' > "$${f%.dat}.svg")
done
stats.html: tweets-per-month.svg stats.cpp Makefile
cp /usr/share/gnuplot/gnuplot/*/js/gnuplot_svg.js .
{
n=0
printf '%s\n' '' '' '' '
' cut -sd '//! ' -f2 stats.cpp printf '%s\n' '
' '' 'Plots become interactive (for precise figures) on click; the script may also impact scrolling ergonomics on desktop, sorry.' '
' for f in tweets-per-year.svg tweets-per-day-by-year.svg tweets-per-month.svg tweets-per-day-by-month.svg tweets-per-week.svg tweets-per-dayofweek.svg tweets-per-dayofweek-by-year.svg; do printf '