Skip to content

Instantly share code, notes, and snippets.

View liujingyu's full-sized avatar

jingyu liu liujingyu

View GitHub Profile
@liujingyu
liujingyu / Linux:batch.md
Last active June 17, 2017 08:58
Linux batch replace string

linux 批量操作

find . -name '*.php' | xargs perl -pi -e  's/BindedConstant/LingBinded/g'
@liujingyu
liujingyu / Git:subtree.md
Last active June 17, 2017 08:54
Git subtree example

git subtree

  1. 添加子目录,建立与luka项目的关联。(--squash 禁止用)
git remote add -f content-console ssh://[email protected]:10022/php/content-console.git

git subtree add --prefix=ext/Content/Console content-console master

Git提交信息规范

每次提交,Commit message 都包括三个部分:Header,Body 和 Footer。

<type>(<scope>): <subject>
// 空一行
<body>
// 空一行

paste 逐行合并两个文件

  • -d 指定两个文件合并后每行之间的分隔符,如:
  • -d " " 以空格作为行之间的分隔符。
  • -d "\t" 以tab键作为行之间的分隔符。
  • -d "任意字符" 以"任意字符"作为行之间的分隔符。
  • -s paste one file at a time instead of in parallel

将合并后的行导入新文件中:

@liujingyu
liujingyu / find_relative_path.func.php
Created October 13, 2016 03:14 — forked from ohaal/find_relative_path.func.php
Find the relative path between two paths
/**
*
* Find the relative file system path between two file system paths
*
* @param string $frompath Path to start from
* @param string $topath Path we want to end up in
*
* @return string Path leading from $frompath to $topath
*/
function find_relative_path ( $frompath, $topath ) {
@liujingyu
liujingyu / php-fpm
Last active April 26, 2016 06:59
php-fpm 启动脚本
#!/bin/sh
#
# php-fpm - this script starts and stops the php-fpm daemin
#
# chkconfig: - 85 15
# processname: php-fpm
# config: /usr/local/php/etc/php-fpm.conf
set -e
@liujingyu
liujingyu / io
Last active August 29, 2015 14:22
IO性能检测
#查看I/O性能
iostat -xm 1
首先找出来磁盘IO操作比较多的进程。这次使用的神器是iotop
iotop -d 1 -obk -a | cut -c -200
#参数-m是以M单位显示,默认K
@liujingyu
liujingyu / yum
Created June 5, 2015 06:57
PHP编译安装时常见错误解决办法
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
yum install libxslt-devel
configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
yum install net-snmp-devel
configure: error: Please reinstall readline - I cannot find readline.h
yum install readline-devel
configure: error: Cannot find pspell
@liujingyu
liujingyu / mem used
Created June 2, 2015 07:11
CentOS下top和free命令查看系统中空闲内存
下面介绍使用top和free命令查看系统中空闲内存
所以你执行top命令看到的
[root@linuxzgf ~]# top
Mem: 8174492k total, 7124268k used,并不是代表你的应用程序已经使用了7.1的内存,这7.1G是包含了:应用程序内存 + 缓冲 + 缓存的内存的,需要用free命令查看.
下面是一个例子(单位是MB):
[root@linuxzgf ~]# free -m
total used free shared buffers cached
Mem: 7982 6811 1171 0 350 5114
@liujingyu
liujingyu / tools.sh
Created May 29, 2015 11:45
InnoDB表结构在线更改工具
随着互联网应用的发展,MySQL数据库的使用也越来越广泛,但是在使用过程中存在或这样或那样的棘手的问题,
其中在线更改表结构和索引,MySQL最好用的存储引擎InnoDB会将所有的写堵塞掉,进一步会堵塞读,从而造成线上业务的不可用,
这在很多情况下是不可接受的。
为了避免这种情况,一直以来可以通过主从复制加以解决,但是操作相对复杂,对于面对成百上千的MySQL数据库,显然成本太高。
为了解决这一矛盾,已经有前人做了工作,我们后人可以乘凉了,下面两款工具,可以帮助解决在有主键的情况下,在线更改表结构。
Python写的 oak-online-alter-table
https://code.google.com/p/openarkkit/source/browse/trunk/openarkkit/src/oak/oak-online-alter-table.py