Wildcard Apache2 Sub Domains

Sub domains in Apache… Here’s the apache config used for this site. This tells apache to serve up all sub domains of dtbaker.com.au from the same /var/www/dtbaker directory <VirtualHost *> ServerName dtbaker.com.au ServerAdmin dtbaker@email.com ServerAlias *.dtbaker.com.au DocumentRoot /var/www/dtbaker/ <Directory /> </Directory> <Directory /var/www/dtbaker> Options Indexes FollowSymLinks MultiViews Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log […]

Website Screenshot Thumbnail Creator Script

One day I needed to create thumbnails of about 300 websites, this
would usually take a very long time, so I wacked together a simple
shell script which makes use of Firefox, Xvfb, and ImagemagickThe
script creates a virtual X desktop, starts a Firefox instance, and
then, using the openUrl command, proceeds to load each website and
capture a screenshot one at a time.If you cannot get Xvfb
working, you should be able to run this with little modification on a
spare linux desktop. I suggest you play with image magicks cropping
tools to remove the firefox decal. here is the original bash script

Simple PHP MySQL Database Functions

A simple bit of code to make PHP database connections a little easier to use.<?phpfunction db_connect(){ $db = mysql_connect(DB_HOST,DB_USER,DB_PASS) or die(“Cannot connect”); $dbcnx = mysql_select_db(DB_NAME) or die (“Cannot select db”); return $db;}function query($sql,$db){ $res = mysql_query($sql,$db) or die(“Error in sql $sql: “.mysql_error()); return $res;}function qa($sql,$db){ $res = query($sql,$db); $data = array(); while($row = mysql_fetch_assoc($res)){ if($res[‘id’])$data[$res[‘id’]] […]