CentOS / Linux: Change Timezone
1. Go to the time zone directory
cd /usr/share/zoneinfo
2. Find the timezone you want (in my case I prefer to run everything in UTC)
3. Copy the timezone you want to the localtime zone for the server. In this case, we’re going to switch the server to use UTC:
cp UTC /etc/localtime
4. Type “y” to overwrite the current timezone.
5. The imezone should be changed automatically. Check the time by running:
date
Thanks goes to http://blog.maestropublishing.com/centos-linux-change-timezone for this tip
1 week ago
using CI libraries with multiple instances
1 week ago
Remove Subsonic ads
1.
sudo nano /var/subsonic/jetty/1524/webapp/WEB-INF/jsp/main.jsp
2. Comment or remove this bit

3.
sudo service subsonic restart
1 month ago
Plesk: The domain is still suspended for the following reason: Domain is expiried
1and1.co.uk default Plesk option on expiry is 1 year instead of unlimited which is insane and will cause the site to go offline at the date.
—
1. Login in to Plesk. Click on Domains. Then on the domain in question.
At the top you should see Unsuspend as an option. (clicking it produces)

2. Click on Resource Usage

Under Validity period, Expiration date enable Never expires and OK
3. Now click Unsuspend.
Done
To prevent this for future domains.
4. Click on Domains in the sidebar, then choose Domain Templates, Default Domain
Enable Unlimited, and OK


5. You can also modify multiple domains on this page by ticking the checkbox then Modify.
The under Limits set the dropdown to Unlimited and OK

1 month ago
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
1 month ago
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
1 month ago
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
1 month ago
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
1 month ago
zip and exclude (-x) DS_Store on Mac
zip -r zipped.zip /path/to/folder/ -x "*.DS_Store"
1 month ago
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 {} \;
1 month ago
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
2 months ago