why did I make this

This commit is contained in:
embr 2021-09-05 12:40:44 +02:00
commit b701f5d6ac
7 changed files with 213230 additions and 0 deletions

11
Makefile Normal file
View file

@ -0,0 +1,11 @@
cookie: dril.dat
fortune dril
dril.html:
wget -O $@ https://cooltweets.herokuapp.com/dril/old
dril: dril.html
./mkfortunes.sh > dril
dril.dat: dril
strfile dril

4
README.md Normal file
View file

@ -0,0 +1,4 @@
dril tweet source: https://cooltweets.herokuapp.com/dril/old
Use this cursed thing by running `fortune dril` (or `make`) in this dir.
To add new posts, remove `dril.html` and re-run `make`.

21897
dril Normal file

File diff suppressed because it is too large Load diff

BIN
dril.dat Normal file

Binary file not shown.

169399
dril.html Normal file

File diff suppressed because it is too large Load diff

21897
fortunes Normal file

File diff suppressed because it is too large Load diff

22
mkfortunes.sh Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
lines=$(cat dril.html |\
# war crimes
grep "<div class='text'>" | sed -e "s%<div class='text'>\(.*\)</div>%\1%" |\
# remove links
grep -vE 'https?://' |\
# remove RTs and replies (but not inline @'s)
grep -v -e '^RT @' -e '^@' |\
# unescape html entities
sed -e 's/\&amp;/\&/g' -e 's/&lt;/</g' -e 's/&gt;/>/g'
)
total=$(echo -n "$lines" | wc -l)
at=1
while read tweet; do
echo $tweet | sed 's%<br />%\n%g'
echo " -- dril"
echo %
(( at++ ))
>&2 echo -ne "\rProcessed: $at / $total"
done <<< "$lines"