Root/ircstat/stat

1#!/bin/sh
2Q=en.qi-hardware.com/irclogs/qi-hardware
3M=en.qi-hardware.com/mmlogs/milkymist
4# Saving to: `en.qi-hardware.com/irclogs/qi-hardware_2010-06-11.log.html'
5
6all=false
7case "$1" in
8-a) all=true;;
9"") break;;
10*) echo "usage: $0 [-a]" 1>&2
11    exit 1;;
12esac
13
14N=4
15t=
16>_out
17n=0
18off=2
19for y in 10 11 12 13 14; do
20    for m in 1 2 3 4 5 6 7 8 9 10 11 12; do
21        mm=`printf "%02d" $m`
22        [ "`echo ${Q}_20${y}-${mm}-*`" = "${Q}_20${y}-${mm}-*" ] &&
23          [ "`echo ${M}_20${y}-${mm}-*`" = "${M}_20${y}-${mm}-*" ] &&
24            continue
25        if [ `expr $n % $N` = 0 ]; then
26            [ "$t" ] && t=$t,
27            t="$t \"$m/$y\" $n"
28        else
29            t="$t, \"\" $n"
30        fi
31# cat ${Q}_20${y}-${mm}-*.log.html | gzip -9 | wc -c >>_out
32        qn=`sed 's/<[^>]*>/ /g' ${Q}_20${y}-${mm}-*.log.html |
33            gzip -9 | wc -c`
34        mn=`{ sed 's/<[^>]*>/ /g' ${M}_20${y}-${mm}-*.log.html;
35              sed 's/^[^ ]* //' m-labs/20${y}-${mm}.txt; } |
36            gzip -9 | wc -c`
37        echo $qn $mn >>_out
38        n=`expr $n + 1`
39    done
40done
41
42if $all; then
43    src=_out
44else
45    src="<sed '\$d' _out"
46fi
47
48gnuplot -persist <<EOF
49set xtics ($t)
50set grid xtics
51set title "Traffic on the Qi-Hardware IRC channels"
52set xlabel "Month"
53set ylabel "Traffic (kbytes gzip'ed)"
54plot "$src" using (\$1/1000) with lines title "#qi-hardware" lw 2, \
55  "$src" using (\$2/1000) with lines title "#m-labs" lw 2, \
56  "$src" using :((\$1+\$2)/1000) with lines title "Both" lw 2
57set term png
58set output "out.png"
59replot
60EOF
61

Archive Download this file

Branches:
master



interactive