phil has a blog

How To Install Memcache And PHP Client On Mac Snow Leopard

Snow Leopard PHP Extensions Installation Tutorial

Install git on OSX

1 . http://code.google.com/p/git-osx-installer/downloads/list

Download the latest (git-1.7.1.1-intel-leopard.dmg as of this post)

2. Mount and install the package, then Log Out and in or just restart to be able to clone

bash batch rename folders in a loop

eg add [V2] after each folder name in the current dir

for i in *; do mv "$i" "$i [V2]"; done

backup

#!/bin/bash
rsync -r -t -v --delete --exclude 'lost+found' --progress /media/storage/ /media/backup/store/
rsync -r -t -v --delete --exclude 'lost+found' --progress /etc/apache2/ /media/backup/etc/apache2/
rsync -r -t -v --delete --exclude 'lost+found' --progress /etc/php5/ /media/backup/etc/php5/
rsync -r -t -v --delete --exclude 'lost+found' --progress /var/www/ /media/backup/var/www/

mysqldump -u root -pPASSWORD --all-databases | gzip > /media/backup/mysql/databases.sql.gz

#svn
rm -rf /media/backup/srv/svn/
mkdir -p /media/backup/srv/svn/
for i in $(ls /srv/svn/); do
        svnadmin hotcopy /srv/svn/$i /media/backup/srv/svn/$i
done

#trac
rm -rf /media/backup/srv/trac/
mkdir -p /media/backup/srv/trac/
for i in $(ls /srv/trac/); do
        trac-admin /srv/trac/$i hotcopy /media/backup/srv/trac/$i
done

mysql_connect() [function.mysql-connect]: [2002] Connection refused (trying to connect via tcp://

mysql_connect() [function.mysql-connect]: [2002] Connection refused (trying to connect via tcp://

WebMin > MySQL Server Configuration

Changed MySQL server listening address to Any from 127.0.0.1

Host ‘192.168.0.x’ is not allowed to connect to this MySQL server

User Permissions > Create new user

Either make one for each IP or set Hosts to Any, and select all Permisions in the options

zip and exclude (-x) DS_Store on Mac

zip -r zipped.zip /path/to/folder/ -x "*.DS_Store"

Ubuntu - find and remove by file ext in current dir

cd to the folder first otherwise you’ll take out unwanted files! eg all doc files in the cd

find . -name '*.doc' -exec rm -r {} \;

Ubuntu format a hard drive

1. fdisk the drive

sudo fdisk /dev/sdb

2. type p

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x07fb9255

3. type d to delete any existing

Command (m for help): d

4. type n for new

Command (m for help): n

p for primary partition

p

1 for the first

1

5. type p again to see the changes

Command (m for help): p

Device Boot Start End Blocks Id System
/dev/sdb1 1 60801 488384001 83 Linux

(If you want to change the system type t and enter the hex code)

6. type w to write the changes

Command (m for help): w

The partition table has been altered!

7. make the filesystem, I chose ext3 (the path above, 1st partition in this case)

sudo mkfs -t ext3 /dev/sdb1

Done

Firefox 4 beta released

Install Ubuntu server on Mac Mini

1. Keep the OSX and partition the HD.

Ubuntu only sounds nice, but really doesn’t play nicely with EFI. You’ll end up with a flashing folder icon with a questionmark.

Open Disk Utility. Select the Hard Drive, Partition tab. Drag the resize arrow up to the top. I used a 120GB and the Leopard got 20GB (needs at least ~16GB) and the 100GB rest as Free Space.


2. Install rEFIt boot menu.

This will allow you to select Linux when the Mac boots.

http://refit.sourceforge.net/

rEFIt (Mac disk image) Just double click the package, install then reboot twice. On the second time you’ll see the boot menu. Use the keyboard to select Partitioning and sync the two partition tables. y to confirm.


3. Install Linux.

Insert the install disk and reboot. You should see Tux holding a CD as an option to select.

When it comes to the partitioning screen choose manual.

Create New > 4 GB > Change use as: to swap area

Return to menu and

Create New > The rest should be calculated (~96 GB) so press next. > Keep as ext4

Return to menu and make sure it looks right.

Make a note as to which number the ext4 is on. In this case partion #4 you want this when it comes to the GRUB install option.

Now press Finish and create.

On the install GRUB, type in /dev/sda with the ext4 partition number you made, do not except any defaults! As I made it fourth after the swap I typed:

/dev/sda4

After the install has completed, on the reboot you’ll see the rEFIt boot menu now with both the Mac and Linux options.

Select Partioning again and sync, it might say nothing needs to be synced.


4 Set Linux to be the default boot option.

As this was headless I want it to go into Linux with just pressing the power on. Boot into the Mac side and open up a terminal.

sudo nano /efi/refit/refit.conf

At the bottom uncomment

#default_selection L

then save (ctrl+x) and close. Reboot and it should countdown with Linux selected and go into GRUB and count down and boot by itself.

F1 2010 E3 Special Report by Inside Sim Racing sponsored by Simraceway

Subversion creating a tag with svn copy

svn copy https://www.example.co.uk/svn/projectname/trunk https://www.example.co.uk/svn/projectname/tags/release-1.0 -m "Tagging the 1.0 release of the 'projectname' project."

Linux Ubuntu Install Setup PHP cURL

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
sudo /etc/init.d/apache2 restart

Use PS2/3 controller with XBOX 360 Controller emulator on Windows

Put in the same dir as the game.exe and run to setup controllers.