Linux

mod_rewriting an entire site

Using mod_rewrite to redirect all pages to one central PHP page’. On my site, I decided to use an all-index structure, as that’s how I prefer to do things – it means that the scripting language is more hidden from the end user than if you linked to pages such as “something-bizarre.jsp” and means that […]

Read More
Linux

mod_rewrite, a beginners guide (with examples)

mod_rewrite is used for rewriting a URL at the server level, giving the user output for that final page. So, for example, a user may ask for http://www.somesite.com/widgets/blue/, but will really be given http://www.somesite.com/widgets.php?colour=blue by the server.

Read More
Photo etc

A EXIF dater script

The script below will take a filename eg: DSCN0001.JPG, extract the “Image Created” metadata and rename the original file to something like 2006-03-23_DSCN00001.JPG and it will do it automatically for you. #! /bin/shfunction usage() {if [ $# -ne 1 ]; then    echo “ExifDater – version 0.1 – March 23 2006”    echo “El-Lotso ” […]

Read More
Scripting

Strip comments from config files

This is at short script to strip/remove comments from config files #!/bin/bash # Code to cat a config file removing all comments and blank lines. grep -vh ‘^[[:space:]]*#’ “$@” | grep -v ‘^$’ Usage: ./confcat.sh /etc/make.conf Alternativ is to use sed cat filename | sed -e ‘s/#.*//;/^\s*$/d’ “$@” This also strips comments at the end […]

Read More
Security

Tunneling ports with SSH

Using -L on the command line with SSh will bind a remote port to a local one. For instance, if you wanted to tunnel the port for a remote desktop (usually 5901) to a local machine, you would type the following ssh -L 5901:localhost:5901 remote_ip You could then access your remote desktop by connecting your […]

Read More