This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /tmp | |
(echo "SET TIME ZONE 'UTC' ;" ; printf "%s\n" '\pset format unaligned' ; printf "%s\n" '\pset fieldsep '\'','\''' ; printf "%s\n" '\pset t' ; printf "%s\n" '\o blog-stats.csv' ; echo 'SELECT id , cdate , length(content::text) FROM entries ORDER BY id ;') | psql weblog | |
gnuplot << '__EOF__' | |
set terminal pngcairo size 1280,960 | |
set output "blog-stats-2023.png" | |
set datafile separator "," | |
stats "blog-stats.csv" using ($1):($3) name "st" | |
ratio=st_sum_y/1024./st_max_x | |
set xdata time | |
set timefmt "%Y-%m-%d %H:%M:%S" | |
set format x "%Y-%m" | |
set mxtics 4 | |
set yrange [0:3000] | |
set ytics 500 nomirror | |
set mytics 5 | |
set y2range [0:3000*ratio] | |
set y2tics 5000 nomirror | |
set my2tics 5 | |
plot "blog-stats.csv" using 2:($1) with lines lw 2 title "entries (left scale)", "blog-stats.csv" using 2:($3/1024.) smooth cumulative with lines lw 2 title "kibichars (right scale)" axes x1y2 | |
__EOF__ | |
convert blog-stats-2023.png -resize 960x480 blog-stats-2023-small.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment