Jan
2012
Oct
2010
VirtualBox Fedora 13 install guest additions
Install packages needed
yum -y install kernel-devel kernel-headers dkms gcc gcc-c++
in VirtualBox devices, select install guest additions
sh VBoxLinuxAdditions.run
Oct
2010
VirtualBox Fedora 13 guest use shared folder
Fedora 13 as guest OS on a Windows 7 host
Add a shared folder in virtualbox’s devices settings.
create a folder “Shared” in fedora
su –c “mount.vboxsf Shared ~/Shared -o rw,exec,uid=1000,gid=1000,dev”
Oct
2010
Create multiple volumn zip backup with MD5 check
Download and install p7zip:
http://p7zip.sourceforge.net/
Then use 7z
Code:
7z a -v50m test.zip your-big-file-paths
this makes 50 MB volumes called
Code:
test.zip.001 test.zip.002 test.zip.003 test.zip.004
To extract them just run
Code:
7z x test.zip.001
make md5
# md5sum test.zip.* > MD5SUM
# cat MD5SUM
cb16175f4acad02f977f74d5c142879b test.zip.001
33c745ca49ab6e63b727658ec148cf67 test.zip.002
14e6952b632fbb7f4c0731067afdb46c test.zip.003
....
check md5
# md5sum --check MD5SUM
Oct
2010
SVN make a sub folder to a seperate new repository
svnadmin dump /svn/old_repos > ./repository.dump
svndumpfilter include path/to/docs --drop-empty-revs --renumber-revs --preserve-revprops < ./repository.dump > ./docs_only.dump
svnadmin load /svn/new_repos < ./docs_only.dump
Oct
2010
Open and edit files from remote server
In my workplace, every developer needs to work on own directory in a shared dev server.
Here is the command I ran to open my directory and edit my files remotely.
1 | sshfs username@192.168.0.6:/remote/directory/path /mount/to/your/local/directory/path |
* 192.168.0.6 is IP of remote server.
After you ran this, access to /mount/to/your/local/directory/path directory is same as access to remote directory.
Have fun.
Oct
2010
Remove svn directories and files
Deleting all SVN files and directories is a headache if your project contains lots of directories.
Here is a easy way to delete them with one command.
1 | find /path/to/your/directory -type d -name .svn -exec rm -rf '{}' + |
Apr
2010
PHP file_get_contents connection timeout
1 2 3 4 5 6 7 8 9 | $context = stream_context_create(array( 'http' => array( 'timeout' => 60 //timeout after 60 seconds ) ) ); $file_content = file_get_contents($source_url,0,$ctx); |
for more stream context options, please visit php.net
Jan
2010
PHP is holiday class
Test out is it a holiday for any given date.
This class currently support United States and Canada’s holidays.
Here is
United States holidays information.
Canadian Holidays information.
This PHP class supports different provinces have its own provincial holidays. For example, December 26th is statutory holiday for Ontario and New Brunswick in Canada.
Usage:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php include_once("IsHoliday.php"); $h = new Holiday('US'); if($h->is_holiday('2010-07-04')) echo "yes, 2010-07-04 is holiday in US <br>"; else echo "no <br>"; //Using Canadian province code for specific province $h = new Holiday('Canada','ON'); if($h->is_holiday('2010-12-26')) echo "yes, 2010-12-26 is holiday in Canada <br>"; else echo "no <br>"; ?> |
Nov
2009
cp file always getting overwrite prompt?
wondering why always getting overwrite prompt when use “cp” command with “-f” option
try this,
1. login as root
1 | vi /root/.bashrc |
2. comment out this line
1 | #alias cp='cp -i' |
3. logout and login again






