Last active
August 29, 2015 14:18
-
-
Save Syrup-tan/b5487a5636c87f0142c7 to your computer and use it in GitHub Desktop.
Hourly cron scripts for https://denpa.moe/~syrup/anya.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Configuration | |
OUTPUT=~/www/anya.txt; | |
## Get the search scripts | |
. ~/www/search.bash; | |
## Get all of the messages from Anya that contain danbooru | |
from_buffer '#r/a/dio' | grep_nick 'Anya' | grep 'danbooru' > "$OUTPUT"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Configuration | |
INPUT=~/www/anya.txt; | |
OUTPUT=~/www/anya.html; | |
## Prepare output file | |
cp "$INPUT" "$OUTPUT"; | |
## Render HTML | |
sed -i'' ' | |
# Strip tags | |
s/</\</g ; s/>/\>/g ; | |
# Add anchors | |
s/\(http\(s\|\):\/\/danbooru\.donmai\.us\/\(posts\|pools\)\/[0-9]*\)/<a href="\1">\1<\/a>/g ; | |
# Wrap in <pre> | |
1s/^/<pre>/ ; | |
$s/$/<\/pre>/ ; | |
# Add script tag | |
$s/$/<script src=anya.js defer async><\/script>/ ; | |
# Add iframe | |
$s/$/<iframe id=image frameborder=0 scrolling=no><\/iframe>/ ; | |
' "$OUTPUT"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See https://gist.github.com/Syrup-tan/81c88961d3e0059eb3d7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment