Tao He

Tao He

  • Docs
  • API
  • Help
  • Blog

›Recent Posts

Recent Posts

  • Microsoft PowerPoint
  • Chrome
  • Alfred
  • Docusaurus
  • Git Commands

通过IP地址上Google(旧)

June 7, 2014

{% include JB/setup %}

本文最新地址上Google的方法汇总(持续更新中)

Vim

June 6, 2014

{% include JB/setup %}

Compile

macOS

Python Support

brew install python
brew install python3

Vim will drop all python linking flags while you build with enable both python2 and python3 binding.

So use either --enable-pythoninterp or --enable-python3interp. Do not use both of them.

If use both, /opt/bin/vim --version shows +python/dyn and +python3/dyn

But :py3 print("hello") in vim returns

E370: Could not load library
E263: Sorry, this command is disabled, they Python library could not be loaded.

Python library could not be loaded

Lua Support

brew install lua --with-completion

Method 1: MacVim (Recommended)

Method 1.1: Homebrew (Recommended)
brew info macvim
brew options macvim
brew install macvim --with-luajit --override-system-vim

Add these lines to ~/.zshrc

alias vi="mvim -v"
alias vim="mvim -v"
Method 1.2: Build From Source

Can NOT use YouCompleteMe

https://github.com/macvim-dev/macvim/releases

mkdir -p ~/src/vim/
cd ~/src/vim/
tar xf macvim-snapshot-74.tar.gz
cd macvim-snapshot-74/src
./configure --with-features=huge --with-compiledby=taohe --enable-multibyte --enable-xim --enable-cscope --enable-rubyinterp --enable-pythoninterp --enable-perlinterp --enable-luainterp --with-lua-prefix=/usr/local/Cellar/lua/5.2.3_1
make

Add these lines to ~/.zshrc

alias vi='vim'
alias vim="$HOME/src/vim/macvim-snapshot-74/src/MacVim/build/Release/MacVim.app/Contents/MacOS/Vim"

Method 2: Vim

Download Vim Source

vim-7.4.tar.bz2

brew install ncurses
mkdir -p ~/src/vim/
cd ~/src/vim/
tar jxf vim-7.4.tar.bz2
Patch Vim

vimgdb-for-vim7.4

cd ~/src/vim/
tar zxf vimgdb-for-vim7.4.tar.gz
patch -p0 < vimgdb-for-vim7.4/vim74.patch
Fix Bugs on macOS

vimgdb74osxfix

This patch must be applied after vimgdb patch

patch -p0 < vimgdb74osxfix/vimgdb74osxfix.patch

Compiling Vim on Osx Maverick

Configure and Make
cd vim74/src/

with python2

./configure --with-features=huge --with-compiledby=taohe --enable-multibyte --enable-xim --enable-cscope --enable-rubyinterp --enable-pythoninterp --enable-perlinterp --enable-luainterp --enable-gdb --with-lua-prefix=/usr/local/Cellar/lua/5.2.3_1

with python3

./configure --with-features=huge --with-compiledby=taohe --enable-multibyte --enable-xim --enable-cscope --enable-rubyinterp --enable-python3interp --enable-perlinterp --enable-luainterp --enable-gdb --with-lua-prefix=/usr/local/Cellar/lua/5.2.3_1
make
sudo make install
/opt/bin/vim --version

Ensure +gdb and +python3

Link

Add /opt/bin to $PATH in ~/.zshrc

link vi

cd /usr/local/bin

if test -f vi; then
    mv -f vi vi.bak
fi
ln -s /opt/bin/vim vi

cd -

Ubuntu

vi/vim使用进阶: 在VIM中使用GDB调试 – 使用vimgdb

ubuntu8.10及之后版本build编译vim出现buffer overflow【修正上面的方法中运行会崩溃】

即make之前先运行下面命令

./configure --enable-cscope --enable-gdb --enable-multibyte --enable-xim --enable-pythoninterp CFLAGS="-O3 -D_FORTIFY_SOURCE=1"

Advanced

vi/vim使用进阶: 剑不离手 – quickfix

vi/vim使用进阶: 在VIM中使用GDB调试 – 使用pyclewn

使用gvim+pyclewn+gdbserver进行远程调试

Configuration

Navim

Plugins

lightline-buffer

Profile

vim --cmd "profile start profile.txt" --cmd "profile file ~/.config/nvim/vimrc" +q && vim profile.txt

MySQL Migration

June 6, 2014

{% include JB/setup %}

mysql database migration

linux mysql table name

Makefile

June 6, 2014

{% include JB/setup %}

跟我一起写 Makefile

Configure,Makefile.am, Makefile.in, Makefile文件之间

Makefile.am, Makefile.in, Makefile文件之间关系

Linux Server

June 6, 2014

{% include JB/setup %}

AWS

ssh -i ~/workspace/amazon/taohe-key-pair-us-west-2.pem ec2-user@ec2-50-112-154-81.us-west-2.compute.amazonaws.com

CentOS

Ubuntu Server

network

vim /etc/networks/eth0
static ip 192.168.0.81

参考Redhat与Ubuntu系统的网卡配置方法比较

install desktop (not vnc)

sudo apt-get install --no-install-recommends ubuntu-desktop
sudo apt-get install language-pack-zh-hans

Linux Firewall

June 6, 2014

{% include JB/setup %}

CentOS

Clear and init

iptables -X
iptables -F
service iptables save
service iptables restart

Disable

sudo service iptables stop

Add rule

iptables -A INPUT -s 101.227.4.21 -j DROP
service iptables status
service iptables save
service iptables restart

Enable

sudo service iptables restart

Ubuntu

Disable

sudo ufw disable

Enable

sudo ufw enable

Apache

June 6, 2014

{% include JB/setup %}

关闭防火墙

Linux Firewall

配置MySQL环境

MySQL

配置PHP环境

1. 安装组件、可选组件

Ubuntu

Install

sudo apt-get install apache2 php5 php5-mysql phpmyadmin
sudo apt-get install redis-server
sudo apt-get install php5-redis
sudo dpkg-reconfigure phpmyadmin

Choose yes and unix socket

Configure phpMyAdmin in Apache

sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
sudo vim /etc/apache2/apache2.conf

Add the following to the bottom of the file

# phpMyAdmin Configuration
Include /etc/phpmyadmin/apache.conf

Restart

sudo service apache2 restart

How to Install and Configure phpMyAdmin on Ubuntu 12.04

CentOS 6

sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo yum update
sudo yum install httpd php php-mysql phpMyAdmin memcached php-pecl-memcached

CentOS 5

sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
sudo yum update
sudo yum install httpd php php-mysql phpMyAdmin memcached php-pecl-memcached

2. 更改phpMyAdmin访问权限

CentOS

sudo cp /etc/httpd/conf.d/phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf.bak
sudo vim /etc/httpd/conf.d/phpMyAdmin.conf

找到<Directory /usr/share/phpMyAdmin/>

在# Apache 2.4中,注释掉#Require ip 127.0.0.1

在# Apache 2.2中,注释掉#Deny from All

3. 服务

CentOS

su root
/sbin/chkconfig iptables on
service httpd restart
service httpd status
/sbin/chkconfig httpd on
service memcached restart
service memcached status
/sbin/chkconfig memcached on
su taohe
pgrep memcached
netstat -tulpn | grep :11211
memcached-tool localhost:11211 stats

*. 测试Apache

客户端上浏览器输入http://localhost/测试是否能打开

*. 测试PHP

/var/www/html/下添加phpinfo.php文件

客户端上浏览器输入http://localhost/phpinfo.php测试是否能打开

客户端上浏览器输入http://localhost/phpmyadmin.php测试是否能打开。默认用户名为root

*. 测试Memcached

vi /etc/php.d/memcached.ini
php -m | grep memcached

*. 修改配置

伪静态(Rewrite),让Apache支持.htaccess

vim /etc/httpd/conf/httpd.conf

确保这行没有注释

LoadModule rewrite_module modules/mod_rewrite.so

依照注释找到以下行把AllowOverride的值改为All

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride All

上传文件限制

vim /etc/php.ini

改写这行

upload_max_filesize = 40M

配置网络访问的MySQL

1. 帐号授权

最简单的方法,在phpmyadmin的“权限”标签页里面为root增添客户端的IP

或者参照mysql 远程连接数据库的方法集合

2. 配置远程可访问

文件/etc/mysql/my.cnf中,注释掉这一行

#bind-address       = 127.0.0.1

参考远程连接Mysql数据库问题(ERROR 2003 (HY000))

3. 修改最大连接数

把max_connections这个值改大,例如改成1000

配置防火墙

sudo cp /etc/sysconfig/iptables /etc/sysconfig/iptables.bak
sudo vim /etc/sysconfig/iptables

Add these lines before -A INPUT -j REJECT line

80 (http)

-A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT

443 (https)

-A INPUT -p tcp --dport 443 -m state --state NEW -j ACCEPT

Linux Iptables: HowTo Block or Open HTTP/Web Service Port 80 & 443

开启防火墙

Linux Firewall

Windows PXE

June 2, 2014

{% include JB/setup %}

Windows下创建PXE网络安装linux

Windows 7作PXE Server网络安装Ubuntu 10.04

Vim Shortcut

June 2, 2014

{% include JB/setup %}

VIM分割窗口,比较文件

vim: vs sp 调整窗口高度和宽度

TortoiseGit

June 2, 2014

{% include JB/setup %}

tortoisegit: Windows用户使用Git的福音

使用gitosis和tortoisegit打造自己的git服务

← PrevNext →
Tao He
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2019 Your Name or Your Company Name