mysql replace函数备忘

UPDATE  wp_posts  SET post_content =  REPLACE (post_content, 'http://', 'https://' ) where post_content like "%http://%"

Linux Killed 已杀死 查看原因

终端显示 "Killed" 或 "已杀死".

查看方式如下

dmesg | egrep -i -B100 'killed process'

或:
egrep -i 'killed process' /var/log/messages
egrep -i -r 'killed process' /var/log

或:
journalctl -xb | egrep -i 'killed process'

svn: Can't convert string from 'UTF-8' to native encoding:(临时解决方案)

更新SVN的时候遇到错误:svn: Can't convert string from 'UTF-8' to native encoding:

查看locale :

[root@103 test]# locale             
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=

[root@103 test]#

[root@103 test]# export LC_ALL=zh_CN.UTF-8
[root@103 test]# locale

LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8

[root@103 test]# svn up .

CentOS6.6安装ShadowSocks服务

CentOS6.6安装ShadowSocks服务

  • 查看系统

cat /etc/issue

  • 安装ShadowSocks

yum install python-setuptools && easy_install pip
pip install shadowsocks
或者按官方教程安装 shadowsocks-servers

  • 创建配置文件

/etc/shadowsocks.json
touch /etc/shadowsocks.json
vi /etc/shadowsocks.json
单用户配置:

{
    "server": "your-server-ip",
    "local_address": "127.0.0.1",
    "local_port": 1080,
    "server_port": 443,
    "password": "password",
    "timeout": 600,
    "method": "rc4-md5"
}

多用户配置:

{
    "server": "your-server-ip",
    "server_port": 443,
    "local_address": "127.0.0.1",
    "local_port": 1080,
    "port_password": {
         "8388": "password",
         "8389": "password"
       },
    "timeout": 600,
    "method": "rc4-md5"
}

加密方式官方默认使用aes-256-cfb,推荐使用rc4-md5,因为 RC4比AES速度快好几倍。
各字段说明:

{
    server:服务器IP
    server_port:服务器端口
    local_port:本地端端口
    password:用来加密的密码
    timeout:超时时间(秒)
    method:加密方法,可选择 “bf-cfb”, “aes-256-cfb”, “des-cfb”, “rc4″等
    }
  • 使用配置文件在后台运行shadowsocks服务

ssserver -c /etc/shadowsocks.json -d start
备注:若无配置文件,在后台可以使用一下命令运行:
ssserver -p 443 -k MyPass -m rc4-md5 -d start

  • 停止服务

ssserver -c /etc/shadowsocks.json -d stop

  • 开放端口

有时候服务器可能不会自动开启对外端口,所以可以使用iptables开启:
iptables -I INPUT -p tcp --dport 8388 -j ACCEPT

  • 参考

https://github.com/PickerLee/www.pickerlee.com/wiki/CentOS6.6%E5%AE%89%E8%A3%85ShadowSocks%E6%9C%8D%E5%8A%A1

linux 防火墙允许端口号方法

  • 查看哪些端口被打开 netstat -anp

  • 关闭端口号 iptables -A INPUT -p tcp --drop 端口号 -j DROP
    iptables -A OUTPUT -p tcp --dport 端口号 -j DROP

  • 打开端口号 iptables -A INPUT -ptcp --dport 端口号 -j ACCEPT

  • 或者直接修改文件vi /etc/sysconfig/iptables

  • 最后记得重启防火墙
    /etc/rc.d/init.d/iptables restart