Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # extract postid and datestamp (in secs since epoch)
- sed 1,2d postdata_mefi.txt \
- |awk -F '\t' '$1 ~ /^980..$/ {print $1,$3}' \
- |while read postid datestamp; do
- echo $postid $(date -d "$datestamp" +%s);
- done \
- |sort -k1b,1 \
- >posts
- sed 1,2d favoritesdata.txt \
- |awk -F '\t' '$4 == 2 && $6 ~ /^980..$/ {print $6,$7}' \
- |while read postid datestamp; do
- echo $postid $(date -d "$datestamp" +%s);
- done \
- |sort -k1b,1 \
- >favs
- # convert fav timestamps to time-since-post, first 24 hours only,
- # bin into 30-minute bins
- join -j1 posts favs \
- |awk '{print $1, int(($3-$2)/(30*60))}' \
- |sort -k1b,1 -k2 -n \
- |uniq -c \
- |awk '$3 < 48 {printf "%d:%02d %d\n",$2,$3,$1}' \
- |sort -k1b,1 \
- >x
- # add zero lines
- seq 98000 98099 \
- |while read n; do seq -f "$n:%02.0f" 0 47; done \
- |join -j1 -a1 - x \
- |awk '$2 == "" {$2=0} {print}' \
- >data
- # make graphs
- seq 98000 98099 |while read n; do
- echo $n >&2
- (cat <<EOF
- %!PS-Adobe-3.0 EPSF-3.0
- %%BoundingBox: 0 0 49 49
- 1 setlinewidth
- 0.5 0.5 translate
- gsave
- 0 0 0 setrgbcolor
- 1 1 translate
- /bar { exch 0 moveto 0 exch rlineto stroke } def
- EOF
- grep "^$n:" data |sed -e 's,^.*:,,' -e 's,$, bar,'
- cat <<EOF
- grestore
- 0.5 0.5 0.5 setrgbcolor
- 0 0 moveto 0 48 lineto 48 48 lineto 48 0 lineto closepath stroke
- %%EOF
- EOF
- ) |convert eps:- $n.png
- done
- montage -geometry +1+1 980*.png montage.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement