EMACS & 程序 编程点滴...

天下难事必作于易,天下大事必作于细

Lastupdated: 2010-12-07

各种配置

TOPCygwin

安装了Cygwin以后,如果想cd到不同的驱动器,可以使用以下的方法。
1
2
3
4
5
6
7
8
9
10
11
12
#from Cygwin to c drive
$cd /cygdrive/c

or

$mount c:\home /home/yang
$mount c:\opt /opt
$mount -c /

or

$mount --change-cygdrive-prefix /

TOP网络相关

TOP服务器名称,hostPC名称,网络设置

1
2
3
4
5
$vi /etc/hosts
  # Do not remove the following line, or various programs
  # that require network functionality will fail.
  127.0.0.1 localhost.localdomain localhost
  192.168.11.2 www.********.co.jp

TOPnetwork

1
2
3
4
5
6
7
$vi /etc/sysconfig/network
  NETWORKING=yes
  HOSTNAME=xxxxxxx
  GATEWAY=192.168.0.1
  HOSTNAME=www.********.co.jp
  DOMAINNAME=********.co.jp
  GATEWAY=192.168.11.1

TOPresolv.conf

1
2
3
4
5
$vi /etc/resolv.conf
  domain ********.co.jp
  search ********.co.jp
  nameserver 219.***.***.** プライマリDNSサーバIPアドレス
  nameserver 203.***.***.** セカンダリDNSサーバIPアドレス

TOPdhcpd.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$cat /etc/dhcpd.conf
 ddns-update-style interim;
 ignore client-updates;
 subnet 192.168.0.0 netmask 255.255.255.0 {
           option subnet-mask      255.255.255.0;
              # 固定 IP の割り当て
           host emma2th {
                    #hardware ethernet 00:E0:C3:06:00:B9;
                    hardware ethernet 00:E0:C3:06:05:FF;
                    #hardware ethernet 00:22:33:44:55:66;
                    fixed-address 192.168.0.2;
                    option routers 192.168.0.1;
                    option root-path "192.168.0.1:/home/xxxx/rootfs";
           }
 }

TOPtftp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$mkdir /tftpboot
$chown nobody:nobody /tftpboot

$cat /etc/xinetd.d/tftp

service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot -c
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

$/etc/rc.d/init.d/xinetd reload

tftp [-i] computer [get | put] source [destination]

/sbin/chkconfig --level 345 xinetd on
/sbin/chkconfig --level 345 tftp on

TOPnfs

1
2
3
4
5
6
$cat /etc/exports
/home/public client1 (rw,no_root_squash)
/home/xxxx/rootfs 192.168.0.0/255.255.255.0(rw,no_root_squash)

$service portmap start
$service nfs start

TOP网关

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$route add -net 192.168.1.0 -netmask 255.255.255.0 gw 192.168.0.100 dev eth1
表示到192.168.1.0/255.255.255.0这个网络的信息通过你的第二块网卡发送,
下一跳(网关): 192.168.0.100
目的IP:      192.168.1.0
子网掩码:    255.255.255.0

下一跳路由的IP地址肯定要跟这个路由器的某个接口是在同一个网段的。

# 关闭防火墙相
$service iptables stop
# 更改MAC地址
$ifconfig eth0 down
$ifconfig eth0 hw ether 00:11:AA:BB:CC:DD
$ifconfig eth0 up

参考这里


TOPbash profile的例子

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
    ################################
    #Bash Profile
    ################################

    ################################
    # Shell Environmental Variables
    ################################
    export EDITOR="nano"
    export LANG=ja_JP.UTF-8
    export LESSCHARSET=utf-8

    ################################
    # SpaceCube Development
    ################################
    #for Linux
    if [ $machine = linux ];
    then
    export BD=/usr/local/te
    export GNUs=/usr
    export GNU_BD=$BD/tool/Linux-i686
    export GNUmips=$GNU_BD/mips64el-unknown-tkernel
    export GCC_EXEC_PREFIX=$GNU_BD/lib/gcc-lib/
    export PATH=$PATH:${GNU_BD}/etc
    fi

    #for Mac
    if [ $machine = macintosh ];
    then
    export BD=/usr/local/te
    export GNUs=/usr
    export GNU_BD=$BD/tool/unknown
    export GNUmips=$GNU_BD/mips64el-unknown-tkernel
    export GCC_EXEC_PREFIX=$GNU_BD/lib/gcc-lib/
    export PATH=$PATH:${GNU_BD}/etc

    alias spca="screen /dev/tty.usbserial-000012FD 115200"
    alias spcb="screen /dev/tty.I-O\ DATA\ USB-RSAQ5 115200"

    alias gmake=make

    fi

    ################################
    # Groovy
    ################################
    export GROOVY_HOME=~/bin/groovy-1.5.3
    export PATH=$GROOVY_HOME/bin:$PATH


    ################################
    # Image Magick
    ################################
    if [ $machine = macintosh ];
    then
    export MAGICK_HOME="/usr/local/ImageMagick-6.4.5"
    export PATH="$MAGICK_HOME/bin:$PATH"
    export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"
    fi

    ################################
    # Aliases
    ################################
    #change directory
    alias up="cd .."
    alias upup="cd ../.."
    alias "cd..."="cd ../.."
    alias "cd.."="cd .."

    #list commands
    alias sl="ls"
    alias la="ls -lah"
    alias lsl="ls -lah"
    alias l="ls -lh"
    alias lsla="ls -lah"
    alias ll="ls -lh"
    alias lpa="ls -a |less"
    alias lp="ls |less"
    alias ks="ls"
    alias sk="ls"
    alias lsd="ls -d */"
    alias lsdir="ls -d */"
    alias l2="ls 2*"
    alias lss="ls |less"
    alias lsc="ls |cat"
    alias grep='grep --color'

    #pager and editor
    alias exho="echo"
    alias h=head
    alias t=tail
    alias nano="nano -w -i"
    alias n="nano"
    alias n="nano -wi"
    alias nn="nano -wi"
    alias nanao="nano -wi"

    alias p="cat"


    #secure shells
    alias sshtp="ssh teampanda.net"
    alias sshc="ssh yuasa@ceres.phys.s.u-tokyo.ac.jp -Y"
    alias sshp="ssh yuasa@phobos -Y"
    alias sshj="ssh yuasa@janus -Y"
    alias sshd="ssh -Y yuasa@deimos.phys.s.u-tokyo.ac.jp"
    alias sshhy="ssh yuasa@hyperion -Y"
    alias sshr="ssh yuasa@rhea -Y"
    alias ssht="ssh yuasa@tethys -Y"
    alias ssh="ssh yuasa@hyperion -Y"
    alias ssha="ssh yuasa@amalthea.phys.s.u-tokyo.ac.jp -Y"
    alias sshpod="ssh pod@teampanda.net"
    alias sshae="ssh -Y hxd@aelnx2.astro.isas.jaxa.jp"

    #terminals
    alias gt="gnome-terminal&"
    alias gter="gt"
    alias gt4="gnome-terminal --geometry 80x20+10+0 & gnome-terminal --geometry
    80x20+10+450 & gnome-terminal --geometry 80x20+720+0 &
    gnome-terminal --geometry 80x20+720+450 &"
    alias gt3="gnome-terminal --geometry 80x20+10+450 &
    gnome-terminal --geometry 80x20+720+0 & gnome-terminal --geometry
    80x20+720+450 &"
    alias gt2="gnome-terminal --geometry 80x20+720+0 & gnome-terminal --geometry
    80x20+720+450 &"


    #gnuplot
    alias gp="gnuplot"

    #postscript related
    alias pasjps="ps2eps --ignoreBB -R + -f"


    #x-ray data analysis
    alias ciao="source /users/yuasa/work/chandra/cxc/bin/ciao.bash -o"
    alias fh="fhelp"
    alias xsel="xselect"
    alias xse="xselect"
    alias ds=ds9
    alias ge="gedit "
    alias dis45="/adsoft/dis45/2.04/linux/dis45x"
    alias dis="dis45"

    #mail
    alias evo="evolution $> /dev/null &"


    #shell
    alias quit="exit"
    alias rep="source ~/.bash_profile"
    alias pur="rm *~;ls"

    ################################
    # Prompt
    ################################
    export PS1='\u@\[\033[1;31m\]\H\[\033[0m\][\W]\$ '

    ###########
    # Functions
    ###########
    function lsdir() { ll $1 | grep '^d'; }
Cygwin 的.bashrc配置::
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Interactive operation...
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Default to human readable figures
alias df='df -h'
alias du='du -h'

# Misc :)
alias less='less -r'                          # raw control characters
# alias whence='type -a'                        # where, of a sort
alias grep='grep --color'                     # show differences in colour

# Some shortcuts for different directory listings
alias ls='ls -hF --color=tty'                 # classify files in colour
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias ll='ls -l'                              # long list
alias la='ls -A'                              # all but . and ..
alias l='ls -CF'                              #


# Functions
# #########

# Some example functions
# function settitle() { echo -ne "\e]2;$@\a\e]1;$@\a"; }

###########
# Functions
###########
function lsdir() { ll $1 | grep '^d'; }

#svn add
function svnadd() { svn st|grep '^?'|awk '{print $2}'|xargs svn add; }

#svn del
function svndel() { svn st|grep '^!'|awk '{print $2}'|xargs svn del; }

#delete .svn
function delsvn() { find ./ -name ".svn" -exec rm -fr {} \;; }

#astyle
function gstyle() { find ./ -type f -name "*.[ch]pp" | xargs -n1 astyle -A2 -N -z1 -j -c -q -p -w -x -k1 && find ./ -type f -name "*.orig" -exec rm -fr {} \;; }


export PATH=$PATH:/c/emacs-lisp/global_win32_exe/bin

mount --change-cygdrive-prefix /

TOPLinux操作系统的头文件和库文件搜索路径

TOPGCC的环境变量

CPLUS_INCLUDE_PATH   --> Gcc编译时查找的头文件路径(for c++)
C_INCLUDE_PATH       --> Gcc编译时查找的头文件路径(for c)
OBJC_INCLUDE_PATH    --> Gcc编译时查找的头文件路径(for objective-c)
PKG_CONFIG_PATH      --> Gcc编译时查找的库的metadata信息路径

内定目录
/usr/include
/usr/local/include

LIBRARY_PATH         --> Gcc编译/链接时用到的库路径
内定目录
/lib
/usr/lib
/usr/local/lib

TOP运行时动态库的搜索路径

1、在配置文件/etc/ld.so.conf中指定动态库搜索路径
2、通过环境变量LD_LIBRARY_PATH
3、/lib
4、/usr/lib
© www.yifeiyang.net
net tracking

                                                                                                 stats