Thursday, October 13, 2011

notes: my index-creator-script

remember how i used to place my notes online in segregated files?(http://linusramos.blogspot.com/2011/07/just-so-you-know.html)

here's the script i ran every time i had to update my notes:
ls /usr/local/apache2/htdocs/linus/notes/ > /usr/local/apache2/htdocs/linus/notes/x
cp /usr/local/apache2/htdocs/linus/notes/x /usr/local/apache2/htdocs/linus/notes/y
cp /usr/local/apache2/htdocs/linus/notes/x /usr/local/apache2/htdocs/linus/notes/z

# used ^ cuz problematic when using perl %s $ in script
perl -e 's/^/<a href="/g' -p -i /usr/local/apache2/htdocs/linus/notes/x
perl -e 's/^/">/g' -p -i /usr/local/apache2/htdocs/linus/notes/y
perl -e 's/^/<\/a>/g' -p -i /usr/local/apache2/htdocs/linus/notes/z

paste /usr/local/apache2/htdocs/linus/notes/x /usr/local/apache2/htdocs/linus/notes/y /usr/local/apache2/htdocs/linus/notes/z > /usr/local/apache2/htdocs/linus/notes/index.html
rm -rf /usr/local/apache2/htdocs/linus/notes/x
rm -rf /usr/local/apache2/htdocs/linus/notes/y
rm -rf /usr/local/apache2/htdocs/linus/notes/z
chown -Rf nobody:root /usr/local/apache2/htdocs/linus/notes
chmod -Rf 755 /usr/local/apache2/htdocs/linus/note


saved it as xCreateIndex.sh. you can even see the script file in the image in the link above. crazy, huh?

No comments:

Post a Comment

SSH : No matching host key type found. Their offer: ssh-rsa,ssh-dss

Got this while connecting to my mikrotik router via ssh   Unable to negotiate with <ip address> port <ssh port>: no matching hos...