Posts

Showing posts from April, 2013

[ Level 1 ] A good editor, Sublime.

Here is a power editor called "Sublime", please follow the link to get more information. http://www.sublimetext.com/ Some useful settings: 1. enable vim. In Perferences -> Settings-Default, empty the value of ignored_packages, e.g. "ignored_packages": [], Default ignore the package Vintage, the vim pakcage. 2. default with command mode. Add one line in Perferences -> Settings-User: "vintage_start_in_command_mode": true, The default mode of vintage would be "command mode" 3. tab for 4 spaces. In Perferences -> Settings-Default, modify the value of tab_size with 4, e.g. "tab_size": 4, And also modify the value of translate_tabs_to_spaces with true, e.g. "translate_tabs_to_spaces": true, 4. auto-trim tailing spaces. Add one line in Perferences -> Settings-User: "trim_trailing_white_space_on_save": true, Wish this helps. regards, Stanley Huang

[ Level 3 ] The script for creating virtualbox envrionment (Ubuntu 12.04) with lauch new OS image.

In my company, I need to test it when I build a new image. Therefore I have to setup my testing environment for integration test. I wrote a script to automatically setup the environment from new install Ubuntu. The steps are: 1. Download and setup tftp server. 2. Download and setup dhcp server with netboot option. 3. Install virtualbox. After that you could create a VM then choose netboot. (the first interface must connect to tap0 to get boot server information) #!/bin/bash ######## utilities ######## _getTasks() { indent="$1" cat $0 | grep '()' | grep -v "^_" | grep "^[^ ]" | cut -d'(' -f1 | sed -e "s/^/$indent/" } _showUsage() { indent=" " cat <<EOF Usage: $0 task Ex. $0 `_getTasks | head -1` tasks: ${indent}[ all ] `_getTasks "$indent"` EOF } _die() { echo "$1" exit ${2:-1} } _checkID() { uid=`id | cut -d'(' -f1 | cut -d'=' -f2` [ $uid -ne

[ Level 3 ] The script for setup the Ubuntu for Juniper VPN.

There is an paper told us how to setup Ubuntu 12.04 for Juniper VPN. Then I follow the guide and also write a script for installation/setup. The steps as the following: 1. Download ans install ia32-libs to support 32 bit libraries. 2. Download and install x64 JRE, jre-7u21-linux-x64.tar.gz. 3. Create plugin link for firefox/google chromium. 4. Update alternative Java. 5. Download and install i586 JRE, jre-7u21-linux-i586.tar.gz. After that, you could login to your VPN. #!/bin/bash ## url link for 64 bit JRE. jre_x64_source_url=http://javadl.sun.com/webapps/download/AutoDL?BundleId=76853 ## url link for 32 bit JRE jre_i586_source_url=http://javadl.sun.com/webapps/download/AutoDL?BundleId=76851 die() { echo "$1" exit ${2:-1} } checkRootID() { uid=`id | cut -d'(' -f1 | cut -d'=' -f2` [ $uid -ne 0 ] && die "Need root to execute this command, exit!" } checkRootID pek2c() { bDebug && read -p "Press enter key t

[ Level 1 ] How to remove rc listed in dpkg -l @Ubuntu.

You could use dpkg -P to remove it. e.g. $ dpkg -l virtualbox Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==================================-======================-======================-========================================================================= ii virtualbox 4.1.18-dfsg-1ubuntu1.1 amd64 x86 virtualization solution - base binaries $ apt-get remove virtualbox ... $ dpkg -l | grep virtual ... rc virtualbox 4.1.18-dfsg-1ubuntu1.1 amd64 x86 virtualization solution - base binaries rc virtualbox-qt 4.1.18-dfsg-1ubuntu1.1 amd64 x86 virtualization solution - Qt based user interface $ pac

[ Level 2 ] Ubuntu package install script.

I wrote an easy script for install Ubuntu packages. #!/bin/bash # # This script is for install popular packages # #$: check package, if exists, skip the following prefix #^ #@: apt-get install packages #!: unix command #^@: apt-get install packages, depends on previous #$ #^!: unix command, depends on previous #$ # showUsage() { cat <<EOF Usage: $0 $0 [package name] Ex. $0 $0 rdesktop EOF } isPackageNotInstall() { dpkg -l $1 >/dev/null 2>&1 if [ $? -eq 0 ] then echo "Package '$1' exists, skip it!" return 1 else return 0 fi } getContent() { declare -i begin declare -i end declare -i size begin=$1 end=$2 size=$end-$begin+1 tail -n +$begin $0 | head -$size } getPackageName() { echo $1 | cut -d' ' -f2- | cut -d'#' -f1 } getCommand() { echo "$line" | cut -d' ' -f2- | cut -d'#' -f1 } die() { echo $1 exit 1 } aptGetInstall() { echo -n "Start instal

[ Level 2 ] Recovery disk partition utility in for Ubuntu.

There is a tool for Ubuntu could help you to recover disk partition, called "testdisk'. $ sudo apt-get -y install testdisk $ sudo testdisk and choose: Create -> [select disk] -> Intel -> Analyse -> Quick Search -> Write And done~ Wish this helps. regards, Stanley Huang

[ Level 2 ] Enable USB 3.0 in Ubuntu 12.04

After I upgrade 12.04, the USB 3.0 port seems not work. Then I google the solution: add "blacklist uas" in the file /etc/modprobe.d/blacklist.conf Wish this helps. regards, Stanley Huang