Author Archive

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

  • Share/Save/Bookmark

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”

  • Share/Save/Bookmark

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

  • Share/Save/Bookmark

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

  • Share/Save/Bookmark

Mysql fix crashed tables

Sometimes, system halt or power off will make your MySQL database crashed and you without knowing it unless you try to access those bad tables.

Run this Linux command to automatically find crashed tables and fix them.

1
mysqlcheck --auto-repair -A -u <username> -p<password>
  • Share/Save/Bookmark

Change Firefox user agent to mobile devices’

Often you need view your mobile web development on mobile devices. Wouldn’t it be better to have Firefox, web developer, firebug and etc to help you?
You can change your desktop Firefox user agent string to make a mobile web site thinks you are view it from a mobile device.
Here’s how to do it.

  • Type about:config in Firefox address bar. And read the scary warning and proceed
  • Right click on the settings and select New -> String.
  • Enter the preference name: general.useragent.override, enter string value: BlackBerry9000/4.6.0.266 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/120

Then you’ve done.

In above example, “BlackBerry9000/4.6.0.266 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/120″ is Blackberry Bold user agent.

Common user agents
iPhone user agent:
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3
Windows mobile 6 user agent:
Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile M.N)

In case you want to get full desktop power back, just select the settings you just added, and select “Reset”

  • Share/Save/Bookmark

Plesk common shell commands

Reload vhost.conf for single domain

1
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=

Update AWStats for only 1 domain in Plesk

1
/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=you-domain.com
  • Share/Save/Bookmark

Subversion client for Windows command line output unreadable characters

If you use subversion client windows command line

1
svn help

on a Windows system with current language for non-Unicode programs set to a different language such as Chinese Simplified.
You probably will see a screen with strange characters – garbage output in command prompt window.
It’s very easy to fix this by set an environment variable for your system

1
Set LANG=C
  • Share/Save/Bookmark

Simple helloworld c++ program to test noexec tmp partition

1
2
3
4
5
6
7
#include <iostream>
 
int main()
{
  std::cout << "Hello world, compiled with g++ on linux" << std::endl;
  return 0;
}

compile this and move to your secured tmp partition and execute it. If you get a permission error, tmp partition is mounted correctly with noexec.

  • Share/Save/Bookmark

Install VMware tools to Fedora 10 client OS on Windows Vista host OS

Software requirements:

  • Windows Vista Ultimate 64bit
  • VMware workstation 6.5.1
  • Fedora 10 64bit

Install packages that are required to build VMware tools:

1
 yum install gcc make kernel-devel</li>

Step by step guide

  1. Logon to Fedora, and select “Install VMware Tools” from VM menu
  2. After the tool cd was mount, open a terminal window logon as root user and type
    1
    2
    3
    
    cd ~
    mkdir VMware
    cd VMWare
  3. Type:
    1
    
    cp /media/VMware\ Tools/VMwareTools-7.8.4-126130.tar.gz ./
  4. Untar and install by typing:
    1
    2
    3
    
    tar zxpf ./VMwareTools-7.8.4-126130.tar.gz
    cd vmware-tools-distrib/
    ./vmware-install.pl
  5. Config and build VMware tool modules:
    1
    
    vmware-config-tools.pl

    and type y when prompt to build vmware modules

Restart your guest OS and then you should have vmware tool installed. You should be able to see your shared folder from the host OS.

  • Share/Save/Bookmark