2009-11-12

tips

tips

= unison (bi-directional synchronization)
    -testServer
    $ unison -sshargs -axC teal ssh://joulee.dyndns.org/proj/teal

= rsync (uni-directional synchronization)
    rsync -e 'ssh -ax' -avz ./teal joulee.dyndns.org:proj/teal

= LVM:
  • pvdisplay - display attributes of a physical volume
  • lvdisplay - display attributes of a logical volume
= LVM: Moving a volume group to another system
  • pvscan
  • vgexport vg_backup
  • vgimport vg_backup
  • vgchange -ay vg_backup
  • mount /dev/vg_backup/LogVol00 /mnt/backup
= LVM: add a disk partition to current system
  • initializing disk partition
    $ pvcreate /dev/sda2
  • adding physical volume to an existing
    volume group
    $ lvdisplay
    $ lvextend -l +100%FREE /dev/vg_system/eda_tools
    $ umount /dev/vg_system/eda_tools
    $ e2fsck -f /dev/vg_system/eda_tools
    $ resize2fs /dev/vg_system/eda_tools
    $ mount /tools

= octave, rlab: replacement of matlab

= gnuplot
    * gnuplot -persist <script>: keep x11 window after exec <script>
    * x11 plot window
        - help: move to x11 plot window; press 'h'
        - u: unzoom
        - p: previous zoom region
        - right-mouse-button: select zoom region
        - e:

= ssh: Warning: No xauth data; using fake authentication data for X11 forwarding
    details are here ; to fix this problem, run the following command on the local host:
    $ xauth add `echo "${DISPLAY}" | sed 's/.*\(:.*\)/\1/'` . `mcookie`

= Cygwin/X and ssh ForwardX11
    - copy ssh_config to ~/.ssh/config; and set ForwardX11 as yes
    - Or, ssh -Y <remote_host>

= Cygwin/X: Clean way to auto-read ~/.Xresources
    add the following to startxwin.bat:
        %RUN% xrdb -wait -merge ~/.Xresources

=Ten Steps To Higher Cygwin Productivity
    $ updatedb --localpaths='c:/ d:/'
    $ crontab ...
    $ ssh daemon ...

= ssh per-host configuration: specify to login as "ethan" for Host "pc*"
    - ~/.ssh/config:
            Host      pc*
            User      ethan

= keychain
    IBM article OpenSSH key management, Part 1
    - generate ssh key pairs (id_dsa)
    $ ssh-keygen.exe -t dsa
    - copy public DSA key to remote host
    $ scp .ssh/id_dsa.pub ethan@pc2005:
    - login to remote host and concatenate id_dsa.pub to .ssh/authorized_keys
    $ cat id_dsa.pub >> .ssh/authorized_keys
    - edit .bash_profile; add the following to it
        keychain ~/.ssh/id_dsa
        source ~/.keychain/`uname -n`-sh

= emacs
    - indent region: C-M-\
    - mark region:
M-< C-SPC M-> C-M-\

= vim
    - include-search /  definition-search [I, ]I, [i, ]i
        :checkpath
        :set path+=../inc
        :set path+=/usr/include/*
    - TODO: apply auto command for "set path"

= cscope
    - cscope -Rb
    - vim: ctrl \ s




= C: Bit Operators (Programming in C:  A Tutorial)
C has several operators for logical bit-operations.
For example,
x = x & 0177;
forms the bit-wise AND of x and 0177, effectively
retaining only the
last seven bits of x.  Other operators are
| inclusive OR
^ (circumflex) exclusive OR
~ (tilde) 1's complement
! logical NOT
<< left shift (as in x<<2)
>> right shift

= bzr
    Bazaar for CVS Users   
    - bzr pull
    - bzr revert
    - bzr update
    - bzr missing
    Using Launchpad and Bazaar
  bzr init-repo libmodbus
  cd libmodbus
  bzr branch lp:libmodbus/trunk
  bzr branch trunk mou
  cd mou
  (hack, hack, hack)
  bzr commit -m "..."
  cd ../trunk
  bzr pull
  cd ../mou
  bzr status
  bzr info
  bzr merge
  (resolve any conflicts)
  bzr commit -m "initial modbus_over_usb"
  bzr push lp:~yishin-li/libmodbus/mou

   
= svn
    - setup subversion on CentOS
    - Note for SELinux / Fedora Core 3+ / Red Hat Enterprise users:
       
$ chcon -R -h -t httpd_sys_content_t PATH_TO_REPOSITORY
    - consult docs and faqs from svn site
    - CVS to SVN Crossover Guide
    - Choosing a Repository Layout        . repo/
            projA/
                branches/
                tags/
                trunk/
            projB/
                branches/

                tags/

                trunk/
    $ create Repository Layout;
    $ cd repo;
svn import . file:///wrk/svn/ssd/repos (import empty layout dirs only)    $ svn import teal/ file:///wrk/svn/ssd/repos/teal/trunk --message "initial teal import"
    $ svn import csim/ file:///wrk/svn/ssd/repos/csim/trunk --message "initial csim import"
    $ svn co file:///wrk/svn/ssd/repos/teal/trunk teal
    $ svn co file:///wrk/svn/ssd/repos/csim/trunk csim
    - how to patch [1 ] [2]
  
    $ sudo svn import proto/ file:///home/svn/repos/proto/trunk --message "initial proto import"
    $ svn co http://taipei/repos/proto/trunk proto

= x264 related (TODO)
x264.exe -b 1 --qp 10 -B 1000 -o output.h264 foreman_part_qcif.yuv 176x144
mplayer.exe -vo yuv4mpeg -vf dect -nosound dolby-city.vob
x264 -o output.h264 stream.y4m --frames 200 --crf 24 -b3 -m9 -r3 --me tesa -8 -t1 --mixed-refs --progress
gprof path-to-x264.exe gmon.out > x264.profile
the most critical part is Motion Estimation (~50%)

what are you trying to do ? output a raw video file ?

ffmpeg -i input -f rawvideo -vcodec rawvideo output

or -f yuv4mpegpipe -vcodec rawvideo (or -f rawvideo -vcodec yuv4mpegpipe ?)

= change login shell: ypchsh
    3  cp ~ethan/.bash_profile .
    4  cp ~ethan/.bashrc .
    5  cp ~ethan/.sh_alias .
    6  cp ~ethan/.profile .
   15  cp ~ethan/bin/* .
   23  cp ~ethan/.eda_tools .
   77  cp -a ~ethan/.vim .
   78  cp -a ~ethan/.vimrc .
   79  cp -a ~ethan/.gvimrc .

= dnsmasq: a light weight tool for DHCP and DNS

= gdbtui
    + CTRL-L to refresh/redraw the screen

= hime (中文輸入法), ubuntu 12.04
    sudo apt-get install hime
    gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"
    sudo glib-compile-schemas /usr/share/glib-2.0/schemas
    sudo cp noseeing.gtab /usr/share/hime/table/

= gcin, ubuntu 10.04
    + im-switch -s gcin
    + noseeing: /usr/share/gcin/script/noseeing-inst (install boshimi)
    + 系統->偏好設定->gcin 輸入法設定->Default input method and toggle key->勾選 Remote client support (port 9999-) (解決 gcin 被 GDM 預先啟動的問題)

= wagig, ubuntu
    sudo apt-get install wajig

    installr Install package and associated recommended packages
    installrs Install package and recommended and suggested packages
    installs Install package and associated suggested packages

       sudo wajig installrs mozilla-thunderbird
       (replace wajig with apt-get)
       http://ubuntuforums.org/showthread.php?t=43382

= update-rc.d, ubuntu
    - update-rc.d cadence defaults 99
    - How-To: Managing services with update-rc.d

= how to create torrent file
    - maketorrent: http://www.dessent.net/btfaq/#maketorrent
    - tracker list: http://torrentfreak.com/how-to-create-a-torrent/
    - example:
        maketorrent-console http://open.tracker.thepiratebay.org/announce <file/dir>

= dpkg-query -S (Find the package a file is from)

= Setting up VMWare shared folders on Ubuntu guest (for both 12.04 and 10.04)

2009-11-05

ubuntu tips

Ubuntu Server Settings
  • pppoe: sudo pppoeconf
  • Network Time Protocol: sudo apt-get install ntp
  • How-To: Manage services with "update-rc.d"
    sudo update-rc.d _service_name_ defaults 99
  • Internet Connection Sharing: dnsmasq(dns+dhcpd) + Firewall(ufw)
    sudo ufw allow 22
    sudo ufw allow 80
    sudo ufw allow from 10.1.1.0/24

    # to enable DHCPD on eth0:
    sudo ufw allow in on eth0 from any port 68 to any port 67 proto udp
    check also "ufw Masquerading"
  • Firewall (ufw) setting for vsftpd:
    sudo ufw allow ftp
    sudo ufw allow 20/tcp
  • DynDNS
  • gitosis: step to restore git repositories
    • restore ssh keys to /etc/ssh
    • restore git directory to /home/git
    • chown -Rf git:git git


2009-11-01

Ubuntu 安裝中文字型

從 vista 安裝標楷體、細明體等字型到 ubuntu :
sudo mount /dev/sda2 /mnt
sudo mkdir /usr/share/fonts/truetype/ttf-microsoft
cd /mnt/Windows/Fonts
sudo cp mingliu.ttc kaiu.ttf simkai.ttf simfang.ttf \
            simhei.ttf simsunb.ttf simsun.ttc msjh* \
            /usr/share/fonts/truetype/ttf-microsoft/
sudo fc-cache -f -v

sudo apt-get install ttf-mscorefonts-installer


參考文章:
[Ubuntu] 安裝中文字型(文鼎字型、微軟正黑體)
「親愛的」搞定ttf-mscorefonts-installer安裝時出現的錯誤

2009-10-29

Install dotProject on CentOS 5

Install required tools
  1. sudo yum install mysql-server gd php-gd php-ldap php-mysql
  2. sudo /sbin/chkconfig --levels 235 mysqld on
  3. sudo service mysqld start
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
/usr/bin/mysql_secure_installation

References

Installing dotProject on Centos 5
Installing dotProject
使用 DotProject 架設 Project Server,整合 LDAP
CentOS - Apache server with SSL 的作法

2009-10-15

[Ubuntu Netbook Remix] 如何不讓視窗自動放大?

在 Ubuntu Netbook Remix 中開啟的應用程式總是將視窗自動放大,可以用 gconf-editor 來關閉這個功能, 方法如下:
  1. "Alt-F2" 鍵,跳出執行程式的輸入視窗
  2. 輸入 "gconf-editor" ,再點「執行」
  3. "apps->maximux" 中點選 "no_maximize",以關閉視窗自動放大的功能
  4. 完成
  5. 參考討論文章

2009-05-26

Setup Dual Head for EeePC with Ubuntu


  1. refer to How to setup Dual Head for Intel Graphics with RandR 1.2
  2. edit /etc/X11/xorg.conf for Section "Screen"
    SubSection "Display"
    Depth 32

    Virtual 2048 2048

    EndSubSection

  3. restart X with "ctrl-alt-backspace"
  4. confirm the maximum "Screen 0" size is 2048x2048 with "xrandr -q"
  5. set the screen layout
    xrandr --output VGA --pos 0x0
    xrandr --output LVDS --pos 0x1024

EeePC model: 904
Linux distribution: Ubuntu 8.04 LTS

2009-05-04

Build EMC2 on CentOS 5.3 (x86_64)

Required packages:
  • pth-devel
  • bwidget
  • tcl-devel
  • tk-devel
  • libtermcap-devel
  • readline-devel
  • libXmu-devel
  • tkinter
sudo yum install pth-devel bwidget tcl-devel tk-devel libtermcap-devel readline-devel libXmu-devel tkinter
cd /usr/share/tcl8.4; sudo ln -sf ../../share/bwidget1.8.0 BWidget

edit src/hal/utils/Submakefile
  1. locate for ../bin/halrmt
  2. remove $(READLINE_LIBS) from its dependent list
  3. add $(READLINE_LIBS) to "@$(CXX) $(LDFLAGS) -o $@ $^ -lpthread"


../bin/halrmt: $(call TOOBJS, $(HALRMTSRCS)) ../lib/libemcini.so.0 ../lib/libnml.so.0 ../lib/libemchal.so.0
$(ECHO) Linking $(notdir $@)
@$(CXX) $(LDFLAGS) -o $@ $^ -lpthread $(READLINE_LIBS)


cd src
./configure --enable-simulator --enable-run-in-place
make
cd ../; . ./scripts/emc-environment
unset LD_LIBRARY_PATH # to disable incorrect xilinx library search path
emc

2009-05-03

Build EMC2 on Windwos

1. GNU PTH Library
2. BWidget:
  • download BWidget-*.tar.bz2 from tclib.sf.net
  • uncompress and copy it to /usr/share/BWidget
  • verify the installation with 'tclsh'
  • % set auto_path
  • % package require BWidget
Build emc2
  1. cd src
  2. ./configure --enable-simulator --enable-run-in-place
  3. make (stuck at here: cannot build libnml on Windows)
    # Before running the software, set the emc environment:
    # . (top dir)/scripts/emc-environment
    # To run the software type
    # emc
  4. libnml is forked from rcslib
  5. rcslib can be built with MinGW; cannot be built with cygwin
  6. replace libnml with rcslib?
  7. port libnml to cygwin?
  8. skip emc2 and try orocos?