Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
2 total  XML / RSS feed 

Cache a local copy of Google Analytics' urchin.js

Speed up your website by caching Google's urchin.js locally, and then refreshing it @nightly with this here script. Some background:

# urchin.js local caching by Jamie Wilkinson 

# config

# work
wget -O $URCHIN.tmp
if [ -s $URCHIN.tmp ]; then
        rm $URCHIN
        mv $URCHIN.tmp $URCHIN
        chmod 644 $URCHIN

exit 0;

Rolling Apache Logfiles

This is a little snippet I whipped up long ago to roll our logs, feel free to use...


/usr/bin/grep CustomLog /usr/local/etc/apache2/httpd.conf |/usr/bin/grep -v \#|/usr/bin/awk '{print $2}'|/usr/bin/sort|/usr/bin/uniq|/usr/bin/grep -v /var/log > logfiles
/usr/bin/grep ErrorLog /usr/local/etc/apache2/httpd.conf |/usr/bin/grep -v \#|/usr/bin/awk '{print $2}'|/usr/bin/sort|/usr/bin/uniq|/usr/bin/grep -v /var/log >> logfiles
/usr/local/bin/ --loglist logfiles --touchlog --restart_cmd "/usr/local/etc/rc.d/ restart" --compress --days 120

The is a script from Uthe Urchin folk, available at
« Newer Snippets
Older Snippets »
2 total  XML / RSS feed