2017年7月27日 星期四

vim 設定 TAB 為四格空白

set tabstop=4       " The width of a TAB is set to 4.
                    " Still it is a \t. It is just that
                    " Vim will interpret it to be having
                    " a width of 4.

set shiftwidth=4    " Indents will have a width of 4

set softtabstop=4   " Sets the number of columns for a TAB

set expandtab       " Expand TABs to spaces

$ vim ~/.vimrc

tabstop

The width of a hard tabstop measured in "spaces" -- effectively the (maximum) width of an actual tab character.

shiftwidth

The size of an "indent". It's also measured in spaces, so if your code base indents with tab characters then you want shiftwidth to equal the number of tab characters times tabstop. This is also used by things like the =, > and < commands.

softtabstop

Setting this to a non-zero value other than tabstop will make the tab key (in insert mode) insert a combination of spaces (and possibly tabs) to simulate tab stops at this width.

expandtab

Enabling this will make the tab key (in insert mode) insert spaces instead of tab characters. This also affects the behavior of the retab command.

smarttab

Enabling this will make the tab key (in insert mode) insert spaces or tabs to go to the next indent of the next tabstop when the cursor is at the beginning of a line (i.e. the only preceding characters are whitespace).
For more details on any of these see :help 'optionname' in vim (e.g. :help 'tabstop')

2017年5月3日 星期三

QNAP Virtualization Station


QNAP 說明
https://www.qnap.com/zh-hk/how-to/tutorial/article/如何使用-virtualization-station-虛擬機工作站

SSH進去
https://wiki.qnap.com/wiki/How_to_SSH_into_your_QNAP_device

操作 virsh

https://forum.qnap.com/viewtopic.php?t=90425

ssh 或 telnet 進去之後

export LD_LIBRARY_PATH=/KVM/opt/lib:/KVM/opt/lib64/
export PATH=$PATH:/KVM/opt/bin/:/KVM/opt/sbin/

[~] # virsh list --all

[~] # virsh shutdown W7_FR_KVM  //  shutdown "gracefully" of a V.M. 


2017年4月2日 星期日

Start VirtualBox VM from CLI

http://askubuntu.com/questions/445284/how-to-start-a-virtualbox-machine-via-command-line-without-gui

Only needed:
VBoxManage startvm "VM name" --type headless
For example:
VBoxManage startvm ubuservloc --type headless
Additionally, if your VM uses 3D acceleration, it makes sense to (temporarily) disable it, as it'll prevent the VM from starting in headless mode.

2017年3月9日 星期四

VSFTP

yum install vsftpd


--anon
anonymous_enable=NO
-- chroot
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list  --在這裡面加上需要的帳號 --注意deny 有沒有開

-- Iptables

iptables -I INPUT -s {IP}/32 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT

-- SELINUX
setsebool -P allow_ftpd_full_access=1
setsebool -P ftp_home_dir=1

ref
http://shaocian.blogspot.tw/2012/07/centos-vsftpd.html
http://download.ithome.com.tw/article/index/id/2389

----
http://blog.xuite.net/jbass0805/blog/68277061-CentOS+6+FTP+Server+(vsftpd)+and+Secure
編輯/etc/vsftpd/vsftpd.conf新增以下幾條

pasv_enable=YES
pasv_min_port=3000
pasv_max_port=3005

3000~3005是我設定的port range
當然設定完成iptables也要新增一條
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3000:3005 -j ACCEPT
然後重啟iptables

vsftpd passive設定完成
----
http://wuhaoshu.blog.51cto.com/845270/489292

被动模式 下,客户连接 TCP/21,客户再通过其他端口连接服务器的随机端口,卡住的原因,是因为服务器在被动模式下没有打开临时端口让 client 连过来。
临时打洞的方法:
优点:不影响ftp配置;缺点: 客户会感觉到连接有些延迟。原因参见ip_conntract的实现原理
在/etc/modprobe.conf中添加
alias ip_conntrack ip_conntract_ftp ip_nat_ftp
在/etc/rc.local中添加
/sbin/modprobe ip_conntract
/sbin/modprobe  ip_conntrack_ftp
/sbin/modprobe  ip_nat_ftp

限制被动模式连接端口的方法:
  • 优点:对连接速度没有影响。缺点: 限制了客户端并发连接的数量。
在/etc/vsftpd/vsftpd.conf中添加
pasv_enable=YES
pasv_min_port=2222
pasv_max_port=2225
iptables中开放这段端口
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp --dport 2222:2225 -j ACCEPT

2017年2月8日 星期三

AIX5.3 rlwrap



參考 http://blog.csdn.net/lqx0405/article/details/5817769

1、首先安装gcc环境
下载gcc相关包

gcc-4.2.0-3.aix6.1.ppc.rpm, 
gcc-cplusplus-4.2.0-3.aix6.1.ppc.rpm, 
libgcc-4.2.0-3.aix6.1.ppc.rpm, 
libstdcplusplus-4.2.0-3.aix6.1.ppc.rpm, 
libstdcplusplus-devel-4.2.0-3.aix6.1.ppc.rpm 

(1)用ftp将上述五个rpm文件上传到/usr/opt/freeware/src /packages/SOURCES目录下 

(2)以root身份在/usr/opt/freeware/src/packages/SOURCES执行命令 
# rpm -ivh gcc-4.2.0-3.aix6.1.ppc.rpm 
# rpm -ivh libgcc-4.2.0-3.aix6.1.ppc.rpm 
# rpm -ivh libstdcplusplus-4.2.0-3.aix6.1.ppc.rpm 
# rpm -ivh libstdcplusplus-devel-4.2.0-3.aix6.1.ppc.rpm 
# rpm -ivh gcc-cplusplus-4.2.0-3.aix6.1.ppc.rpm

2、安装readline 库文件
1)      解压: gunzip  readline-6.1.tar.gz
2)      解包: tar  -xvf  readline-6.1.tar
3)      安装: cd  readline-6.1
       ./configure ; make ; make install
4)      安装完毕后,readline的库文件,安装在/usr/local/lib 目录下
5)      将相关库文件拷贝到/lib 和 /usr/lib 下

3、安装 rlwrap
 下载  rlwrap-0.37.tar.gz
1)    解压 gunzip  rlwrap-0.37.tar.gz
2)    解包:tar  -xvf  rlwrap-0.37.tar
3)    安装: cd rlwrap-0.37
       ./configure ;  make ; make check ; make install
4、配置
  在/home/oracle/.profile 下建立别名:
 alias   sqlplus=‘rlwrap  sqlplus’
 alias   rman=‘rlwrap  rman’



另外 在
http://www.perzl.org/aix/index.php?n=Main.Rlwrap
好像有編好的版本
http://www.perzl.org/aix/index.php?n=Main.Readline
要先裝 readline