Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 38 lines (34 sloc) 1.012 kB
0061115 tools for dealing with spammers
Justine Tunney authored
1 #!/bin/bash
2 #
3 # i generate text file reports to help you track down abuse. it's a
4 # good idea to have them generated to a secret folder on your
5 # webserver.
6 #
7 # to use me run "crontab -e" and add:
8 #
9 # @hourly nice reports.sh ows /var/www/reports
10 #
11
12 DB=$1
13 DEST=$2
14 THRESHOLD=$3
15
16 [[ $DB ]] || exit 1
17 [[ -d $DEST ]] || exit 1
18 [[ $THRESHOLD ]] || THRESHOLD=20
19
20 for HOURS in 1 4 12 24 48; do
21 cat <<EOF | psql $DB >$DEST/voting-${HOURS}hours.txt
22 select (select username from auth_user where id = uid) as name,
23 vote_count,
24 (select count(*)
25 from occupywallst_article
26 where author_id = uid) as article_count_all_time,
27 (select count(*)
28 from occupywallst_comment
29 where user_id = uid) as comment_count_all_time
30 from (select user_id as uid, count(*) as vote_count
31 from occupywallst_commentvote
32 where time > now() - interval '$HOURS hour'
33 group by uid
34 order by vote_count desc) as A
35 where vote_count > $THRESHOLD;
36 EOF
37 done
Something went wrong with that request. Please try again.