Skip to content

Instantly share code, notes, and snippets.

@Syrup-tan
Last active August 29, 2015 14:18
Show Gist options
  • Save Syrup-tan/b5487a5636c87f0142c7 to your computer and use it in GitHub Desktop.
Save Syrup-tan/b5487a5636c87f0142c7 to your computer and use it in GitHub Desktop.
Hourly cron scripts for https://denpa.moe/~syrup/anya.html
#!/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";
#!/bin/sh
## Configuration
INPUT=~/www/anya.txt;
OUTPUT=~/www/anya.html;
## Prepare output file
cp "$INPUT" "$OUTPUT";
## Render HTML
sed -i'' '
# Strip tags
s/</\&lt;/g ; s/>/\&gt;/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";
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