Introduction
Introduction Statistics Contact Development Disclaimer Help
tAdapt memestats to bitreich.org. Remove IRC log stuff. - bitreich-memestats - …
git clone git://src.adamsgaard.dk/bitreich-memestats
Log
Files
Refs
LICENSE
---
commit e082f9a06845793bcfa455df769420c1c926a85e
parent 277b24006ce8268150ece65be9a02607df09f55e
Author: Christoph Lohmann <[email protected]>
Date: Sun, 29 Aug 2021 20:21:50 +0200
Adapt memestats to bitreich.org. Remove IRC log stuff.
* There is no IRC channel logging by privacy policy of bitreich.
Diffstat:
M Makefile | 30 ++++--------------------------
M extract-memecount.sh | 1 +
D memeuse.awk | 70 -----------------------------…
D top10.sh | 17 -----------------
4 files changed, 5 insertions(+), 113 deletions(-)
---
diff --git a/Makefile b/Makefile
t@@ -1,18 +1,14 @@
.POSIX:
MEMECACHE = "/br/gopher/memecache"
-ANNNA = "$(HOME)/annna"
-IRCLOG = "$(HOME)/.irssi/log/Freenode/\#bitreich-en.log"
+ANNNA = "/home/annna/bin"
-memecount: plot-memecount.sh top10 media-stats memecount_lin memecount_semilog
- cat memecount_lin top10 media-stats memecount_semilog > $@
+memecount: plot-memecount.sh media-stats memecount_lin memecount_semilog
+ cat memecount_lin media-stats memecount_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 > $@
t@@ -23,26 +19,8 @@ memecount_semilog: plot-memecount.sh memecount.log
memecount.log: extract-memecount.sh
./extract-memecount.sh $(ANNNA) > $@
-# 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)" \
- '{print $$1/N_weeks"\t"$$2}' all_time_use.tsv > $@
-
-# output format: total_uses<tab>tag
-all_time_use.tsv: memeuse.tsv
- cut -f5 memeuse.tsv | sort | uniq -c | sort -r | \
- awk '{print $$1"\t"$$2}' > $@
-
-# format: day<tab>date<tab>time<tab>user<tab>tag
-memeuse.tsv: memeuse.awk
- awk -f memeuse.awk $(IRCLOG) > $@
-
clean:
- rm -f memeuse.tsv
- rm -f all_time_use.tsv
- rm -f all_time_weekly_popularity.tsv
- rm -f top10
rm -f media-stats
rm -f memecount{,.log,_lin,_semilog}
-.PHONY: brtv clean
+.PHONY: clean
diff --git a/extract-memecount.sh b/extract-memecount.sh
t@@ -4,6 +4,7 @@
annnadir="${1:-$HOME/code/annna}"
memefile="modules/hashtags/hashtags.txt"
update_annna=yes
+fromrevision="${2}"
if [ ! -e "${annnadir}/${memefile}" ]; then
printf 'error: could not open %s\n' "${annnadir}/${memefile}"
diff --git a/memeuse.awk b/memeuse.awk
t@@ -1,70 +0,0 @@
-#!/usr/bin/awk -f
-# get timestamp, user, and tag from irssi log in default format
-
-function extract_date(s) {
- gsub(/--- Day changed ... /, "", s);
-
- match(s, /[0-9][0-9]/);
- day = substr(s, RSTART, RLENGTH);
-
- match(s, /[0-9][0-9][0-9][0-9]/);
- year = substr(s, RSTART, RLENGTH);
-
- month = s;
- gsub(/.*Jan .*/, "01", month);
- gsub(/.*Feb .*/, "02", month);
- gsub(/.*Mar .*/, "03", month);
- gsub(/.*Apr .*/, "04", month);
- gsub(/.*May .*/, "05", month);
- gsub(/.*Jun .*/, "06", month);
- gsub(/.*Jul .*/, "07", month);
- gsub(/.*Aug .*/, "08", month);
- gsub(/.*Sep .*/, "09", month);
- gsub(/.*Oct .*/, "10", month);
- gsub(/.*Nov .*/, "11", month);
- gsub(/.*Dec .*/, "12", month);
-}
-
-function extract_user(s) {
- if (/<.*>/) { # regular message
- gsub(/.*<./, "", s);
- gsub(/>.*/, "", s);
- } else { # action
- gsub(/.*\* /, "", s);
- gsub(/ .*/, "", s);
- }
- return s;
-}
-
-function extract_tag(s) {
- match(s, /#.*/);
- s = substr(s, RSTART, RLENGTH);
- gsub(/ .*/, "", s);
- gsub(/[!?:,\.]$/, "", s);
- return s;
-}
-
-function extract_time(s) {
- match(s, /[0-2][0-9]:[0-5][0-9]/);
- return substr(s, RSTART, RLENGTH);
-}
-
-{ }
-
-# update date for subsequent entries
-/--- Day changed / {
- extract_date($0);
- n_days++;
-}
-
-# find tag in current line
-/ #[A-Za-z0-9]+/ {
- if (! /< annna>/ && ! /#bitreich-en/) {
- tag = extract_tag($0);
- if (!match(tag, "#nospoil")) {
- printf("%s\t%s\-%s\-%s\t%s\t%s\t%s\n",
- n_days, year, month, day,
- extract_time($0), extract_user($0), tag);
- }
- }
-}
diff --git a/top10.sh b/top10.sh
t@@ -1,17 +0,0 @@
-#!/bin/sh
-# print table to stdout containing top 10 memes with averaged usage per week
-
-printf '\n '
-printf '+------ top 10 (uses per week) ------+\n'
-i=1
-head "all_time_weekly_popularity.tsv" | while read u t; do
- printf ' '
- printf '| %2d. %-23s %6.3f |\n' \
- "$i" \
- "$t" \
- "$u"
- i=$((i+1))
-done
-
-printf ' '
-printf '+------------------------------------+\n'
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.