Louis's Blog


  • Home

  • Archives
Louis's Blog

知识积淀

Posted on 2017-01-20
    转眼间已工作三年多,时间如白驹过隙,时不我待。
    这三年多有进步、有积累,但诚然觉得自己还是没有什么突出之处,至少相较同学同事们来说是这样的。
虽说如此,但是自己意识到的,自己能控制的总还是努力尽力做好,有新的热门的技术也积极的去了解学习,
所以在日积月累中,也积淀下来一些自以为然的知识。当然这些基本都是搜索到的其他高人的杰作,只是自
己觉得纵然是拿来主义的方式积累的东西,但确实是自己解决问题中找到的关键性的精华,对于解决问题大
有裨益,所以存为笔记以供自己日后查看,便于解决以后遇到的同样的问题,同时如果能“意外”帮到其他
人那也算自己在传播人类知识方面做了一点点小贡献。
    所以特此将自己有道云笔记的地址分享于此:

http://note.youdao.com/noteshare?id=ccb16bd4b4840c447ba69ef9c4d93fe6

Louis's Blog

How to manage your Hexo blog source code

Posted on 2017-01-07

Demo Repository

How to add a new branch to save hexo source code

1
2
3
4
5
6
7
cd /path/to/you/hexo
git init
git checkout -b sourcecode
git remote add https://github.com/shushanxingzhe/shushanxingzhe.github.io.git
git add .
git commit -m 'save source code'
git push origin sourcecode:sourcecode

Get source from Github and add new blog

Clone source

1
git clone -b sourcecode https://github.com/shushanxingzhe/shushanxingzhe.github.io.git github.io

Update dependency

1
2
cd github.io
npm update

Create New Blog

1
2
3
4
hexo new "New Blog Title Here"
#write you blog in the source/_posts directory
hexo s
#run server on local,and check it

Generate and Deploy

1
hexo d -g

Update source code to Github

1
2
3
git add .
git commit -m 'add new blog'
git push
Louis's Blog

Useful PHP Extension

Posted on 2016-12-30
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
monolog/monolog
twig/twig
swiftmailer/swiftmailer
phpoffice/phpexcel
intervention/image
elasticsearch/elasticsearch
predis/predis
phpunit/phpunit
php-amqplib/php-amqplib
phploc/phploc
sleeping-owl/admin
基础
php5.6-opcache
php5.6-common
php5.6-curl
php5.6-fpm
php5.6-cli
php5.6-json
php5.6-mbstring
php5.6-mcrypt
php5.6-mysql
php5.6-gd
php5.6-xml
php5.6-zip
数据
php-memcached
php-mongodb
php-redis
zookeeper (pecl)
PDO (pecl)
php-amqp
性能
php-xhprof
swoole (pecl)
php-xdebug
Louis's Blog

Efficient Command

Posted on 2016-12-30
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
find . -type d -name ".svn"|xargs rm -rf 删除当前目录及子目录下的svn文件
svn st | awk '{if ($1 == "?") {print $2} }' | xargs svn add svn添加所有新增文件
find . -type d -exec chmod 700 {} \; 修改所有目录访问权限
find . -type f -exec chmod 600 {} \; 修改所有文件访问权限
find . -name "*.php" -exec php {} \; 执行所有的php文件
grep -rli "helper('itags')" * | xargs -i@ sed -i "s/helper('itags')/helper('core')/g" @ 将所有文件中包含的某字符串替换成另一字符串
grep -rli --include=*.php.dec '?><?php' . | xargs -i@ sed -i "s/?><?php/<?php/g" @
pcregrep -MHrin --color "addOrder.*\n.*1442470135100001" . 多行搜索(跨行)
set quote="'" ; phpgrep -i '\(select\|update\|delete\|insert\).*;\("\|${quote}\)' . 搜索以分号;结尾的SQL语句
set quote="'" ; phpgrep -i '\(select\|update\|delete\|insert\).*[^;]\("\|${quote}\)' . 搜索不以分号;结尾的SQL语句
find . -name '*.php.dec' -exec sh -c 'mv $0 ${0/.php.dec/.php};' {} \; 搜索文件并重命名
find . -name 'article*' | sed -e "p;s/article/blog/" | xargs -n2 mv 搜索文件并重命名(通用性强)
find . -name '*respond*' -exec sh -c ' grep -Hrin --color --exclude-dir=.svn "1442299522100003" $0' {} \; 搜索文件 并查找文件中的的字符串
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=1 } END { printf ("%d\n", sum) }' 显示某程序进程总数
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }' 显示某程序平均内存占用数
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/1024,"M") }'
显示某程序占用内存总数
ps --no-headers -o "rss,pcpu,cutime,cstime,utime,cmd" -C redis-server | awk '{ sum+=$1;pcpu+=$2;cutime+=$3;cstime+=$4;utime+=$5 } END { printf ("rss:%d%s\n pcpu:%d\n cutime:%d\n cstime:%d\n utime:%d\n", sum/1024,"M",pcpu,cutime,cstime,utime) }' 显示某程序占用的资源
Louis

Louis

4 posts
© 2017 Louis
Powered by Hexo
Theme - NexT.Mist