Mercurial > repo
annotate bin/pastelog @ 2367:75116167989a
<Jafet> (echo \'#!/usr/bin/python\'; echo \'import random; w=[l.split() for l in open("/dev/stdin").read().split("\\n")]; r=[4,7,8,9,2,13,6]; print "\\n".join((lambda s: " ".join(chr(3) + str(r[(i+s)%len(r)]) + l[i] for i in range(len(l))))(random.randrange(0, len(r))))\') >$(which rainwords)
author | HackBot |
---|---|
date | Mon, 04 Mar 2013 10:36:29 +0000 |
parents | 5c453217583b |
children | be90d778a82d |
rev | line source |
---|---|
0 | 1 #!/bin/sh |
2 cd /var/irclogs/_esoteric | |
3 | |
4 pasterandom() { | |
5 if [ "$1" -gt 150 ]; then | |
6 echo "No." | |
7 exit | |
8 fi | |
9 for i in $(seq "$1"); do | |
10 file=$(shuf -en 1 ????-??-??.txt) | |
11 echo "$file:$(shuf -n 1 $file)" | |
12 done | paste | |
13 } | |
14 | |
15 if [ "$1" ]; then | |
16 if expr "$1" + 0 >/dev/null 2>&1; then | |
17 pasterandom "$1" | |
18 else | |
2257
5c453217583b
<Jafet> sed -i... -e \'s/grep/timeout 25 grep/\' bin/pastelog
HackBot
parents:
0
diff
changeset
|
19 lines=$(timeout 25 grep -P -i -- "$1" ????-??-??.txt | head -n 301) |
0 | 20 { |
21 echo "$lines" | head -n 300 | |
22 [ $(echo "$lines" | wc -l) -eq 301 ] && echo "[too many lines; stopping]" | |
23 } | paste | |
24 fi | |
25 else | |
26 pasterandom 40 | |
27 fi | |
28 |