netatalk 3.0.3 Ubuntu 12.04.2/10.04.3 LTS (Precise Pangolin)

Netatalk for use with Time Machine on MAC OSX Mountain Lion 10.8.3.

sudo -i
apt-get install build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev
wget http://prdownloads.sourceforge.net/netatalk/netatalk-3.0.3.tar.bz2?download
tar jxvf netatalk-3.0.3.tar.bz2?download
mv netatalk-3.0.3 /usr/src
cd /usr/src/netatalk-3.0.3
./configure --with-init-style=debian --with-zeroconf
make
checkinstall
exit

/usr/local/etc/afp.conf:

[Global]
mimic model = TimeCapsule6,106
log level = default:warn
log file = /var/log/afpd.log
hosts allow = 192.168.1.0/16

[TimeMachine]
path = /mnt/timemachine
valid users = tmuser
time machine = yes

For Ubuntu 10.04.03 use this apt-get line instead:

apt-get install build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libdb4.8-dev db4.8-util libgcrypt11 libgcrypt11-dev

Source:
https://gist.github.com/vena/2856490
https://wiki.archlinux.org/index.php/Netatalk#Netatalk

jQuery slideshow

JavaScript:

var bilder = [ // bildene våre
        "img/1.jpg",
        "img/2.jpg",
        "img/3.jpg",
        "img/4.jpg" 
        ];
var i=0; // teller

setInterval(pictureSlide, 5000); // kjør pictureSlide() hvert 5 sekund

function pictureSlide() {
  i++; // øk teller
  if (i == bilder.length) { i=0; } // sett til 0 hvis vi har gått rundt
  var currentImage = $('#slideshow > img');
  var nextImage = $(''); // lag det nye bildet
  nextImage.hide(); // gjem det
  $('#slideshow').prepend(nextImage); // legg til bildet
  nextImage.fadeIn(5000); // fade inn
  currentImage.fadeOut(5000, $(this).remove); // fade ut gammelt bilde samtidig, og fjern etterpå
};

CSS:

#slideshow img {
  position: absolute; // plasserer bildene "oppå" hverandre
}

Sort merged apache log-file by date

#!/bin/bash
if [[ $2 == "" || $1 == "" ]] || [ ! -f $1 ]; then
    echo "Usage: $0 input-file output-file"
    exit
fi
echo "Sorting $1"
sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M -k 4.2,4.3n -k 4.14,4.15n -k 4.17,4.18n -k 4.20,4.21n $1 > $2

Reference: http://stackoverflow.com/questions/5672733/how-can-i-sort-an-apache-log-file-by-date

Parse old gzipped apache(vhost_combined) logs with awstats

Parse all logs to new log-file in chronological order.

zgrep ^blog.seljebu.no `find -name "other_vhosts_access.log.[0-9]*.gz" | sort -n -t . -k 4 -r` | sed 's/./other_vhosts_access.log.[0-9]*.gz:blog.seljebu.no:80 //g' > blog.seljebu.no/old.log
grep ^blog.seljebu.no other_vhosts_access.log.1 | sed 's/blog.seljebu.no:80 //g' >> blog.seljebu.no/old.log
grep ^blog.seljebu.no other_vhosts_access.log | sed 's/blog.seljebu.no:80 //g' >> blog.seljebu.no/old.log

Make config-file for awstats.

#/etc/awstats/awstats.blog.seljebu.no.conf
LogFile="/var/log/apache2/blog.seljebu.no/old.log"
LogFormat=1
SiteDomain="blog.seljebu.no"
HostAliases="blog.seljebu.no"
DirData=/var/lib/awstats

Delete awstats database and update awstats. If you get a lot of corrupted/dropped records, you could use -showcorrupted/-showdropped.

rm /var/lib/awstats/awstats*blog.seljebu.no*
/usr/lib/cgi-bin/awstats.pl -config=blog.seljebu.no -update

Make individual log-files for virtualhosts.


        Servername blog.seljebu.no
        CustomLog /var/log/apache2/blog.seljebu.no/access.log combined
        ...

Add new log files to logrotate.

#/etc/logrotate.d/apache2 
/var/log/apache2/*/*.log /var/log/apache2/*.log {
        weekly
        ...
}

Update awstats config-file.

#/etc/awstats/awstats.blog.seljebu.no.conf
LogFile="/var/log/apache2/blog.seljebu.no/access.log"
...

Add to cron.

#/etc/cron.d/awstats
*/10 * * * * www-data /usr/lib/cgi-bin/awstats.pl -config=blog.seljebu.no -update >/dev/null