URI: 
       Add plot script - bitreich-memestats - Bitreich meme statistics and graphs.
  HTML git clone git://bitreich.org/bitreich-memestats git://hg6vgqziawt5s4dj.onion/bitreich-memestats
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR LICENSE
       ---
   DIR commit e3aca3409bdee91be0505096223c25b318e030ee
   DIR parent fc2311b33218ea7cd9d7d084d33685fbfa3ea85b
  HTML Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Mon, 20 Apr 2020 09:02:00 +0200
       
       Add plot script
       
       Diffstat:
         A plot-memecount.sh                   |      49 +++++++++++++++++++++++++++++++
       
       1 file changed, 49 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/plot-memecount.sh b/plot-memecount.sh
       @@ -0,0 +1,49 @@
       +#!/bin/sh
       +
       +annnadir="$HOME/code/annna"
       +memefile="modules/hashtags/hashtags.txt"
       +statfile="$(mktemp)"
       +update_annna=yes
       +
       +die() {
       +        printf 'error: %s\n' "$1" >&2
       +        exit 1
       +}
       +
       +if [ ! -e "${annnadir}/${memefile}" ]; then
       +        die "could not open '${annnadir}/${memefile}'"
       +fi
       +cd "$annnadir"
       +if [ "$update_annna" = "yes" ]; then
       +        git pull >/dev/null 2>&1
       +fi
       +
       +# derived from Hiltjo Posthuma's loc.sh
       +git log --pretty='format:%H %cd' --date="format:%Y-%m-%d" | \
       +        sort -k 2 | uniq -f 1 | \
       +        while read -r commit date; do
       +
       +        # hashtags originally stored in annna-start-services...
       +        n="$(git show "$commit:annna-start-services" 2>/dev/null | \
       +                grep -E '^        #[a-z0-9]' | wc -l)"
       +
       +        # ...but are now stored in $memefile
       +        if [ "$n" -eq 0 ]; then
       +                n="$(git show "$commit:$memefile" 2>/dev/null | wc -l)"
       +        fi
       +
       +        if [ "$n" -gt 1 ]; then
       +                printf '%s\t%s\t%s\n' "$date" "$commit" "$n"
       +        fi
       +done > "$statfile"
       +
       +gnuplot - <<__EOF__
       +set term dumb
       +set title "annna meme count (total on $(date +%Y-%m-%d): \
       +$(tail -1 "$statfile" | awk '{print $3}'))"
       +set xdata time
       +set format x "%Y-%m"
       +set timefmt "%Y-%m-%dT%H:%M:%S"
       +set xtics 2592000*4
       +plot '$statfile' u 1:3 w lp t '' pt 13
       +__EOF__