2012年5月16日 星期三

20120516 工作筆記

1. 在 linux console 下設定 proxy:
export http_proxy=”
http://hostname:portnumber”

2. SD card (sdb1、sdb2) mount 完成後(假設 mount 在 /media/boot/ 和 /media/rootfs/ 下),將 foo.tar.bz2 解壓到 /media/rootfs/:
tar jxfv foo.tar.bz2 –C /media/rootfs

3. 將 foo.tar.gz 解壓到 /myfolderpath/
tar zxfv foo.tar.gz –C /myfolderpath/

4. check out SVN server 中第 38 個版本:
svn co –r 38 –username MYNAME –password PASSWORD svn://hostip/folder/subfolder

5. 搜尋 FOLDER 資料夾中含有關鍵字 KEYWORD 的檔案並標示行數:
grep –r –n “KEYWORD” FOLDER

6. 讓自己寫的 script 開機後自動執行:
/etc/profile.d/my_script.sh

7. universalIndentGUI => save config file => create batch file (config and batch files shoud be at the same directory)

8. Vim 中的長字串自動完成:ctrl-p 或 ctrl-n

9. Good to use 共用資料夾 in VirtualBox guest OS, it's easy and powerful.

10. shift + right click folder => open command here

11. in 64bit Win7, 32bit-chrome will download 32bit Java by default

12. MSN minimize to system tray => Vista Mode

13. gtags 好像只能在 WinXP 32bit 下面才能正常運作,Win7 x64 無法, 但是在Ubuntu下可以正常運作

14. Good to use easygui in Python

15. win7 刪除服務 sc delete servicename

16. virtualbox network bridge 不能用混合模式

17. mount box.net: https://www.box.net/dav

18. mkmmc-android.sh

   1: #!/bin/bash
   2:  
   3: # Copyright (C) 2009 Andrei Dolnikov <dolnikov.andrei@gmail.com>
   4: #
   5: # Licensed under the Apache License, Version 2.0 (the "License");
   6: # you may not use this file except in compliance with the License.
   7: # You may obtain a copy of the License at
   8: #
   9: #      http://www.apache.org/licenses/LICENSE-2.0
  10: #
  11: # Unless required by applicable law or agreed to in writing, software
  12: # distributed under the License is distributed on an "AS IS" BASIS,
  13: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14: # See the License for the specific language governing permissions and
  15: # limitations under the License.
  16:  
  17: if [[ -z $1 || -z $2 || -z $3 || -z $4 ]]
  18: then
  19:     echo "mkmmc-android Usage:"
  20:     echo "    mkmmc-android <device> <board name> <uImage> <rootfs tar.bz2 archive>"
  21:     echo "    Example: mkmmc-android /dev/sdc beagleboard uImage rootfs.tar.bz2"
  22:     exit
  23: fi
  24:  
  25: if [[ -z `which mkimage` ]]
  26: then
  27:     echo "Please, install mkimage on your host"
  28:     echo "    On Ubuntu systems: sudo apt-get install uboot-mkimage"
  29:     exit
  30: fi
  31:  
  32: if ! [[ -e $2 ]]
  33: then
  34:     echo "Incorrect board name!"
  35:     exit
  36: fi
  37:  
  38: if ! [[ -e $3 ]]
  39: then
  40:     echo "Incorrect uImage location!"
  41:     exit
  42: fi
  43:  
  44: if ! [[ -e $4 ]]
  45: then
  46:     echo "Incorrect rootfs tarball location!"
  47:     exit
  48: fi
  49:  
  50: echo "All data on "$1" now will be destroyed! Continue? [y/n]"
  51: read ans
  52: if ! [ $ans == 'y' ]
  53: then
  54:     exit
  55: fi
  56:  
  57: echo "[Partitioning $1...]"
  58:  
  59: dev_sz=`fdisk -l $1 | grep $1: | awk '{print$(NF-1)}'`
  60: cyl=$(expr $dev_sz / 512 / 63 / 255)
  61: fat_end=$(expr $cyl / 2)
  62:  
  63: fdisk "$1" &> /dev/null << EOF
  64: o
  65: x
  66: h
  67: 255
  68: s
  69: 63
  70: c
  71: $cyl
  72: r
  73: n
  74: p
  75: 1
  76:  
  77: $fat_end
  78: t
  79: c
  80: a
  81: 1
  82: n
  83: p
  84: 2
  85:  
  86:  
  87: w
  88: EOF
  89:  
  90: echo "[Making filesystems...]"
  91:  
  92: mkfs.vfat -F 32 -n boot "$1"1 &> /dev/null
  93: mkfs.ext3 -L rootfs "$1"2 &> /dev/null
  94:  
  95: echo "[Copying files...]"
  96:  
  97: mount "$1"1 /mnt
  98: cp $3 /mnt/uImage
  99: mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n $2/normal/boot.script -d $2/normal/boot.script $2/normal/boot.scr &> /dev/null
 100: cp $2/normal/boot.scr /mnt
 101: umount "$1"1
 102:  
 103: mount "$1"2 /mnt
 104: tar jxvf $4 -C /mnt &> /dev/null
 105: chmod 755 /mnt
 106: umount "$1"2
 107:  
 108: echo "[Done]"

沒有留言: