WordPress Permissions

Recursively reset the folders and file permissions on a wordpress install

chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--

Simple GIT Example

To initialise a git repository and push local files to a remote repository.

Basic commands to configure your remote URL; add your local files; commit with comment and then push files.

git init
git remote add origin <url>
git add .
git commit -m “Comment”
git push -u origin master

To initialise a git repository and pull down existing repository files.

git clone <url> .

SSH No Password

Simple cheat sheet for connecting via ssh with no password.

#ssh-keygen -t rsa

#cat .ssh/id_rsa.pub | ssh user@server 'cat >> .ssh/authorized_keys'


Install Yosemite by USB

If you experience a hard drive failure and need to re-install the Mac OS X operating system, you can create a USB install media.

You need a working Mac and a minimum of an 8GB USB pen drive.

  1. On a working Mac running Yosemite go to the AppStore and download Yosemite.
  2. Plug in the USB and format it using Mac OS X (Journaled) with a GUID partition scheme – leave the name as Untitled
  3. Open ‘Terminal’
  4. Use the following command
sudo /Applications/Install OS X Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install OS X Yosemite.app --nointeraction

It takes a good 20 minutes to complete and once finished, in the  ‘Terminal’ app, you will see the line

Copy complete.

Put the USB drive into the Mac you want to install on and when it boots hold down the alt key and choose your USB drive.

Open an Application from the command line

If you regularly use the command line and want to directly open an application and pass a file to it you can use the following:

open -a TextEdit ~/Documents/myfile.txt

The switch -a says use this application:

More switches from the command line:

open --help 
-a Opens with the specified application.
-b Opens with the specified application bundle identifier. 
-e Opens with TextEdit.
-t Opens with default text editor.
-f Reads input from standard input and opens with TextEdit.
-F --fresh Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
-R, --reveal Selects in the Finder instead of opening.
-W, --wait-apps Blocks until the used applications are closed (even if they were already running).
-n, --new Open a new instance of the application even if one is already running.
-j, --hide Launches the app hidden.
-g, --background Does not bring the application to the foreground.
-h, --header Searches header file locations for headers matching the given filenames, and opens them.
--args All remaining arguments are passed in argv to the application's main() function instead of opened.

Disk space usage command line

Quite often, after a computer or laptop has been used for a while, we may need to know what is taking up all of the hard drive space.

An open source command-line utility called ‘du’ allows us to check file and directory sizes.

Here is a little snippet to check the size of the items in the present wording directory (also known as `pwd` ).

du -hs ./*|grep ^\.*[0-9]\.[0-9]*G\.*$|sort -n

You should now have a list of files and folders that are 1 Gigabyte or greater in size.

Linux LVM migration

So, you have setup a nice lvm partitioning scheme to future proof life, maybe the system will have a heart attack and need a new mobo; maybe we will fill up 20TB within the next year or so; maybe we get new architecture and want to migrate our huge data store across – ah haa !

So you get the set of lvm drives into the new system, boot up and can see the drives using:

fdisk -l

Great so far so good, now what ?

Well, we dont need to know why, just do this:

pvscan (will search all lvm block devices for physical volumes)

vgscan (scans all disks for volume groups)

If you are here its because you haven’t done this before and therefore have not taken the steps to prepare an lvm migration therefore:

1 – mark the volume group inactive

vgchange -an <volume group name here>

2 – export the volume group

vgexport <volume group>

3 – import the volume group into the system (kernel)

vgimport <volume group>

4 – activate the volume group

vgchange -ay <volume group>

Job done !

You can go ahead and mount as required.

Credited source over here

Linux free memory

Ever find yourself on another Linux system wondering why is this system so slow !

I wonder what RAM is installed I hear you thinking, the answer is the ‘free’ command.

# free

This will show you the amount of free and used memory installed in your machine with the option to use the following switches:

-b this will display the output in bytes

-k again in kilobytes

-m megabytes

-g gigabytes

-h in human readable form

-t will give you column totals

-s <variable> will repeat the command every <var> seconds

Developers Time Cheat Sheet

#      300   5 MIN
#      600  10 MIN
#      900  15 MIN
#     1800  30 MIN
#     2700  45 MIN
#     3600   1 HR
#     7200   2 HR
#    10800   3 HR
#    14400   4 HR
#    18000   5 HR
#    36000  10 HR
#    39600  11 HR
#    43200  12 HR
#    46800  13 HR
#    50400  14 HR
#    54000  15 HR
#    86400  24 HR
#    86400   1 DAY
#   172800   2 DAY
#   259200   3 DAY
#   345600   4 DAY
#   432000   5 DAY
#   518400   6 DAY
#   604800   7 DAY
#   604800   1 WEEK
#  1209600   2 WEEK
#  1814400   3 WEEK
#  2419200   4 WEEK
#  2419200   1 MONTH
#  4838400   2 MONTH
#  7257600   3 MONTH
#  9676800   4 MONTH
# 12096000   5 MONTH
# 14515200   6 MONTH
# 16934400   7 MONTH
# 19353600   8 MONTH
# 21772800   9 MONTH
# 24192000  10 MONTH
# 26611200  11 MONTH
# 29030400  12 MONTH

credit given here

Asterisk dependencies

Dependencies to install asterisk from source:


once having downloaded the asterisk source file into /usr/src and untarred it. There is a useful script that can be found in /usr/src/contrib/scripts/ called ‘install_prereq’.
Pass the parameter ‘install’ and sit back !

Force fsck on reboot

If you want to instigate a filesystem check on a Linux file system during the next reboot, create a blank file called forcefsck in the root directory (/).

I would suggest running the following commands as an administrator or user with elevated permissions:

touch /forcefsck


Worldwide Recovery Systems

Worldwide Recovery Systems

LCRM is proud to present the recently refurbished WWRS website.

Working closely with the team at WWRS has helped produce a satisfying end result.

Worldwide Recovery Systems build and supply many different types of vehicles including:

Service Vans
Multi-car carriers
Accident Units

The newly refurbished website provides a streamlined view of their vehicles.

WWRS also supply accessories such safetywear, lifting gear, lighting and more.

Take a look at http://www.worldwiderecovery.co.uk.

Imapsync migration from Zimbra to Kerio

If you are setting up a new Kerio mail server and want to use imapsync to port across your emails, this following command helps to re-locate your email folders from the existing server into a nice way on your tidy new Kerio server.

imapsync –syncinternaldates –subscribe –ssl1 –ssl2 –authuser1 admin –user1 user1 –passfile1 /home/user1/.passwordfile –user2 olduser1 –passfile2 /home/user1/.oldpasswordfile –sep2 / –prefix2 “INBOX/” –nofastio1 –nofastio2

That should nicely transfer all existing emails into their respective folders underneath your new Kerio Inbox folder.

replace admin; user1; user2; /home/user1/{.passwordfile, .oldpasswordfile} with your details.



Zimbra Imapsync problems

Seems there has been a breakdown in communication between Imapsync developers and main distro developer teams – perhaps even perl – – who knows !!

Anyhow there is a problem at hand between Imapsync and Mail::Client.


Subroutine Authuser redefined at /usr/bin/imapsync line 2557.

imapsync needs perl lib Mail::IMAPClient release 2.2.9 exactly, future imapsync release may suppoort 3.0.x, but sorry not now. See file BUG_IMAPClient_3.xx

# Looks like your test died before it could output anything.


rpm --nodeps -e perl-Mail && rpm -ivh ftp://rpmfind.net/linux/dag/redhat/el5/en/i386/dag/RPMS/perl-Mail-IMAPClient-2.2.9-1.2.el5.rf.noarch.rpm


SSH Certificate No Password not working

Hi all,

For Linux administrators ,SSH is as important ,if not more so, than a watch.

Typing in a password every time a remote connection is established is detrimental to both workflow and security.

Using the tried and tested

cat .ssh/id_rsa.pub | ssh admin@remote.com 'cat >> .ssh/authorized_keys'

to bypass the password prompt is a great help.

However, it has been found that sometimes this doesnt work, the answer might be the permissions on the ‘authorized_keys’ file.

The solution (on the remote server – after executing the above command)

cd .ssh && chmod 600 authorized_keys

Now logoout and try to re-connect using ssh again

Hope this helps

How to re-install a package using YUM

If you use many distros you probably think ‘why hasn’t yum got a re-install’..

me too

But i found a work-around

rpm -e --justdb --nodeps %packagename%

yum install %packagename%

Thats a way to ensure you only remove the specified package allowing you to use yum to reinstall it again.

Found the original article and info here


Linux DHCP server bind eth0

So I installed VMWare server and wanted to know how to set my DHCP server to listen on just eth0.

Simple answer on Fedora is to edit


adding the following


Setting up VNC as a service

Hi all,

Question: Many times I wondered why is there a vnc service and why does it always fail on startup?

Answer: Simple configuration of the /etc/sysconfig/vncservers


this sets up a remote desktop service for user ‘john’ with a resolution of 1024×768

edit /etc/sysconfig/vncservers


VNCERSVERARGS=[2]="-geometry 1024x768"

If you want more than one user to have access, do the following:

VNCSERVERS="2:john 3:paul 4:harry"

VNCSERVERARGS[3]="-geometry 800x600"

VNCSERVERARGS[4]="-geometry 1600x1200"

That’s it.

Restart your vnc service and add it to the startup line:

/etc/init.d/vncserver restart

chkconfig vncerver on


Setting up two printers on a single machines

If you have only one parallel port and need to connect two printers check to see if one has an ethernet port with an RJ45 connector, if so here is what you do:

Connect up your parallel port printer as needed and install as neccesary with drivers and such.

Find yourself a cross-over cable and and extra ethernet card, and manually connect up the second printer to the new network card.

Manually configure the second ‘Local Area Network Connection’.

Most probably the following setting will work on a Windows~ machine.




DNS: <leave empty>

Follow the instructions to setup your ethernet card connected printer with the following configuration:




Now add the new printer by Control Panel > Printers and Faxes, choose Local Printer but do not click the attached directly button.

Click next and then create your own port at the bottom by chooing TCP/IP.

Click next and just type in the IP Address box.

Click next and you should instanty be shown the new printer successful install page – click Finish to Finish.

Thats the best way, you can then share those printers on your locally connected network. The serial pors for printers are useless and parallel port switch boxes are just very inconvenient on a network with more than one PC or laptop.


Ifconfig add an IP address

It’s easy, just run as root:

;ifconfig eth0 192.168.1.x netmask;

The example shows a class c address with a common subnet mask.

The example above also assumes eth0 as the example network adapter. Other common interfaces may be wlan0 for wireless cards on laptops.

How to use a KVM 2-Port Switch

So, you just came across a 2-Port KVM switch and have hooked it up to two PC’s.

Now what ?

How on earth do you switch between machines……?

Simple !

Press the “Scroll lock” key twice

Now use the up/Down arrow key to switch between machines.

Simple, there you go.


Apple Airport Disk Utility

Hello all,

If like me you seem to be missing the Airport Disk Utility and have spent the last few hours searching through Apple’s website for a simple download then are in the right place and at the end of your journey.

Go to http://www.apple.com/downloads and look for the the most recent Airport Base Station update.

  1. Download it and mount it
  2. Right click and show package contents
  3. Copy Archive.pax.gz to your desktop
  4. Double click on the Archive.pax.gz file
  5. Go to Archive.pax > Applications > Utilities
  6. Copy Airport Disk Utility into /Applications/Utilities


Hard Reset Nokia N95

Having to send my Nokia N95 back for the third time now, all with different problems.

Trying to reset the phone through the Tools menu to factory defaults still did not clear my calendar etc

Then i found out to use the network command:



Reboot, test and reset Apple TV


So to access the service menu of the Apple TV to reboot the box just:

Hold down the ‘ Menu’ button and the menu scroll down button ‘ – ‘

Then select ‘Restart’ to reboot Apple TV.

Select diagnostics to run automated self tests.

Select ‘Factory Restore to reset Apple TV to how you first had it – probably deleting all music, photos off of it too.


Creating an SSL certificate for your Apache webserver

This is my interpretation on setting up a self-signed SSL certificate for an Apache web-server.

The instructions are generic and apply to most versions of Apache on almost any Linux platform.

Firstly, I suggest creating a separate directory to store your SSL certificates e.g.

mkdir /var/www/ssl/mydomain

Now lets browse to the directory we just created:

cd /var/www/ssl/mydomain

We are using the ‘openssl‘ utility to generate our SSL certificate.

Firstly, we create a private key** using:

openssl genrsa -out mydomain.key

Now we generate a certificate signing request or CSR for short using:

openssl rsa -in mydomain.key -out mydomain.csr

Fill in the appropriate fields with relative information….

and, finally create the self-signed certificate using:

openssl x509 -req days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt

This creates a selfsigned ‘mydomain.crt’ for 365 days.

**For safety only allow root to read the private key using:

chown root mydomain.key && chmod 600 mydomain.key

DogsBoutique Best Pup Competition

http://dogsboutique.co.uk are running a monthly competition to find the most pampered pooch.

The winner will win £25 to spend in-store or on-line.

All you need to do is to email us a picture of your groomed model perfect pooch with his name and a contact email address- that’s it!

The competition is running through January only at present but, if it proves popular – it will be back!

email: info@dogsboutique.co.uk with subject “DogsBoutique pooch of the month competition” and attach your image maximum 5MB in size.


Dogs Boutique

203 Baker Street





E-mail us at info@dogsboutique.co.uk,

or give us a call on 020 8363 3299.

Create an m3u playlist

Using Linux BASH environment I needed to find a way to create m3u playlists.

I first trawled the Internet looking a program to automate this for me — none!

So I then decided to find the m3u file syntax to create my own by hand — none!

Reverse engineering an existing m3u (and speaking with an Apple creative genius) I found that m3u files are simply text files which point to mp3 files.

Simple I thought — just use a loop to write file names to an m3u file.

Therefore, current working directory ($CWD) /your/music, within $CWD we have many directories, listed by artist name i.e. /your/music/abba.

Furthermore, within artist directories we have albums i.e. /your/music/abba/album1; /your/music/abba/album2.

This procedure requires entering each album artist i.e. cd /your/music/abba == present working directory.

Now for the script:

for x in */*.mp3; do echo "$x" >> "${PWD##*/}.m3u"; done


We have a file with the name of the artist i.e. abba.m3u which contains a list of all mp3’s within the albums !!

Voila – Amend as necessary


I created a new script file below that allows you to pass directories into – not 100% for everyone but its a good start.

1 – Copy the code into the script m3uplaylist.sh

echo "m3u= $m3u"

for x in “$1″/*/*.mp3; do echo “$x” >> “/your/music/M3u/$m3u”; done

2 – add execute permissions chmod +x m3uplaylist.sh

3 – run sh m3uplaylist.sh /your/music !! do not add trailing ‘/’ !!

4 – [optional] run a for loop to recurse your main music folder for M in /your/music/*; do /bin/sh m3u-playlist.sh $M; done

Done I hope – let me know if you have trouble or can suggest improvements please

Enjoy !

** latest **

finished perfecting the script after many attempts and here is the final code

for i in /your/music/*; do find "$i" -maxdepth 3 -iname "*.mp3" > "$i/${i##'/your/music/'}.m3u";done

BASH SubStrings

I used this command to truncate the beginnings of strings of text from files

for x in *.mp3; do echo "orig: ${x##*'text string'}";done

Another great article is here

and then to move them

for x in *.mp3; do mv "$x" "${x##*'text string'}";done


The work on Dogs Boutique has allowed me to use AJAX for the first time.

The Dogs Boutique website has an online store, selling products such as dog collars, dog beds, dog carriers, dog clothing, dog jewelery and more.

Dogs Boutique Online Store – Everything for your pampered pooch

Dogs Boutique also provides an in-house doggy holiday home service.

DogsBoutique now offers an online store for purchases 24 hours a day.

The shop can be found at http://dogsboutique.co.uk/mail-order

Folder and file sizes using Linux


I have ben using Linux for ages and always wanted to know the size of folders when using the command line.

I often used ..

df -h

.. to find how much space was left on the system drives – but what if you were in a sub-directory of your device and wanted to know which folders were the culprits for eating your away at your ~500GB drive…

du -hs *

That code will tell you the disk usage (du), using options to display the results in human readable form (-h) summarizing the folders only (s).

The * will recurse the current directory displaying results for all directories within you current directory.


HSPA University Project


Just finishing my BSc in I.T. and have chosen to write my 8000 word project report on HSPA technology.

Wikipedia has a great section on the past/present and future surrounding technologies such as W-CDMA.

Here is a brief list of the pages I found useful on Wikipedia.


A great book by a couple of Nokia employees also adds some real technical material to the mix:

#15 Tolma Harri; Toskala Antii; (2006) HSDPA/HSUPA for UMTS – High Speed Radio Access for Mobile Communications, John Wiley & Sons Ltd, Wiltshire. [Available from Waterstones – priced ~£65.00 ISBN 0-470-01884-4]

I will be writing some more soon.

Gentoo Mac Samba Copy Problems


If you have followed some instructions on setting up Gentoo and eventually have trouble with samba, I reckon its because your /etc/samba/smb.conf file is bloated with a hole load of unnecessary code.

It just needs to look like this:

workgroup = MSHOME
security = user
local master = yes

valid users = %S
read only = no
browseable = no

That’s it!

Nice simple and secure. Allowing users to login to their home directories.


Mac OpenOffice Problems

Hi all,

Not wanting to buy Microsoft Office and having to use .doc files – I have OpenOffice 2.3 Aqua on my Mac.

It usually takes a while to load which is annoying – so after some searching I found a way to speed it up.

1) As superuser run the following :

sudo su -

nano /Applications/OpenOffice.org\ 2.3.app/Contents/MacOS/sofficerc

simply change 'Logo=1' to 'Logo=0'

To enhance the usability there are some more instructions at the link below:


(shown on Ubuntu Linux but can be applied to any OS)

Right Click Kills Mac OS X Finder

Okay so you are working away day after day and every now and then when you right click on a folder or file all your Finder windows just up and disappear.

Oh that’s a bother but never-mind it will be back in a minute…… or two.

Basically its the contextual menu folder that has an issue and more specifically the StuffItCM.plugin (from stuffit & co).

Simple solution is to :

Go to “~/Library/Contextual Menu Items” or “/Macintosh_HD/Library/Contextual Menu Items” and delete the file StuffItCM.plugin.

Maybe a reboot or logout/login just to be safe and also empty your trash for good!

et voila

Let me know if this works for you with a quick thanks.

I found this out from the thread here.

N95 Hard Reset Code *#7780#

If like me you have constant issues with your Nokia N95 – and the factory default setting does nothing, you can always try the hard code *#7780#.

Always backup your data first and regularly before messing with any settings !

Linux Setting rsync to use a different port number

So you have tightened security on your main server by changing the default port number.

Once a week to backup your server data by using the rsync application on a local backup server – possibly even running a crontab script.

All of a sudden you get errors such as:

ssh: connect to host port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-24.1/rsync/io.c(359)

Why is this ???

The option rsh allows the desired port to be specified through ssh.

In the following example, the -r option specifies ‘recursive’; -z enables compression; –rsh=’ssh -p1234′ tells rsync to use port number 1234 for transfers/connection.

The code would look something like this:

rsync -r -z --rsh='ssh -p1234' /dir1 maybe@me.my.my.domain:/rdir --progress --stats

That’s it enjoy

Mac Desktop Blogging Software

Hi all,

After being pre-occupied for a while I decided to get back into writing on my blog.

I found it quite a hassle, however, as I am sure you also do – to have to keep opening a web browser, logging in, creating a new blog etc….

I thought it would be great to have a piece of software that I could write my blog article in, even when I am not able to login, although hardly ever nowadays.

Continue reading


The work on Dogs Boutique has allowed me to use AJAX for the first time.

The Dogs Boutique website has an online store, selling products such as dog collars, dog beds, dog carriers, dog clothing, dog jewelery and more.

Dogs Boutique Online Store – Everything for your pampered pooch

Dogs Boutique also provides an in-house doggy holiday home service.

If you are going on holiday and do not want to leave your precious pooch in kennels – Dogs Boutique is your answer. They provide a home-from-home service in a doggy friendly environment.

Doggy Holidays

Why not give them a call – not only are they highly experienced but there is also a dog grooming service on-site that has been established for over 30 years.

Dog Grooming Services


Zimbra backup Scripting

Hello all,

I have been busy working on some code that helps admins to backup their Zimbra email servers.

The link to the forum thread is here

I have had some good feedback from my posting and also created a Wiki page for Zimbra.

The link to the Wiki page is here

Blogged with Flock

Ubuntu Picard – No MP3’s

If you are using Ubuntu Feisty and cannot access any MP3’s after installing Picard – I found the best way is use the following procedure:

apt-get build-dep picard -y

apt-get install libtunepimp5-mp3 -y

apt-get source picard

cd picard* && python setup.py install

You can check if you now have MP3 support by open Picard and selecting Help >About.



Blogged with Flock