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’]] […]