Introduction
Introduction Statistics Contact Development Disclaimer Help
tReuse memecount data for both plots - bitreich-memestats - statistical analysi…
git clone git://src.adamsgaard.dk/bitreich-memestats
Log
Files
Refs
LICENSE
---
commit 821d218576745d7ad82ea81c18da04197ebc4c84
parent 3ef3415790635bdf3af5d3b7636a0c5b6c0869f2
Author: Anders Damsgaard <[email protected]>
Date: Mon, 20 Apr 2020 10:15:07 +0200
Reuse memecount data for both plots
Diffstat:
M Makefile | 18 +++++++++++-------
A extract-memecount.sh | 35 +++++++++++++++++++++++++++++…
M plot-memecount.sh | 40 ++++-------------------------…
3 files changed, 50 insertions(+), 43 deletions(-)
---
diff --git a/Makefile b/Makefile
t@@ -4,18 +4,22 @@ irclog = ~/.irssi/log/Freenode/\#bitreich-en.log
memecount: plot-memecount.sh top10 media-stats memecount_lin memecount_semilog
cat memecount_lin top10 media-stats memecount_semilog > $@
-memecount_lin: plot-memecount.sh
- ./plot-memecount.sh > $@
-
-memecount_semilog: plot-memecount.sh
- ./plot-memecount.sh semilog > $@
-
media-stats: media-stats.sh
./media-stats.sh $(memecache) > $@
top10: top10.sh all_time_weekly_popularity.tsv
./top10.sh > $@
+memecount_lin: plot-memecount.sh memecount.log
+ ./plot-memecount.sh memecount.log > $@
+
+memecount_semilog: plot-memecount.sh memecount.log
+ ./plot-memecount.sh memecount.log semilog > $@
+
+# output format: date<tab>commit<tab>n_memes
+memecount.log: extract-memecount.sh
+ ./extract-memecount.sh > $@
+
# output format: avg_uses_per_week<tab>tag
all_time_weekly_popularity.tsv: memeuse.tsv all_time_use.tsv
awk -v N_weeks="$$(awk 'END{print $$1/7}' memeuse.tsv)" \
t@@ -39,6 +43,6 @@ clean:
rm -f all_time_weekly_popularity.tsv
rm -f top10
rm -f media-stats
- rm -f memecount{,_lin,_semilog}
+ rm -f memecount{,.log,_lin,_semilog}
.PHONY: brtv clean
diff --git a/extract-memecount.sh b/extract-memecount.sh
t@@ -0,0 +1,35 @@
+#!/bin/sh
+# generate table of hashtag numbers over time
+
+annnadir="$HOME/code/annna"
+memefile="modules/hashtags/hashtags.txt"
+update_annna=yes
+
+if [ ! -e "${annnadir}/${memefile}" ]; then
+ printf 'error: could not open %s\n' "${annnadir}/${memefile}"
+ exit 1
+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
diff --git a/plot-memecount.sh b/plot-memecount.sh
t@@ -1,44 +1,12 @@
#!/bin/sh
-# output ascii plot of hashtag evolution
+# output ascii plot of hashtag evolution generated with extract-memecount.sh
-annnadir="$HOME/code/annna"
-memefile="modules/hashtags/hashtags.txt"
-statfile="$(mktemp)"
-update_annna=yes
-
-die() {
- printf 'error: %s\n' "$1" >&2
+if [ $# -ne 1 ]; then
+ printf 'usage: %s <file>\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"
-
-[ "$1" = "semilog" ] && semilog="set log y"
+[ "$2" = "semilog" ] && semilog="set log y"
gnuplot - <<__EOF__
set term dumb
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.