Skip to content

Instantly share code, notes, and snippets.

View itomg's full-sized avatar

Jimmy Zhao itomg

View GitHub Profile
@itomg
itomg / statPermissionNum.sh
Last active December 30, 2015 07:59
Show file or directory permission number, like ls -l, used for chmod 644 [file or directory path]
## Linux
stat -c %a [file or directory path]
## Mac OS X
stat -f "%Lp" [filename]
select column_name from information_schema.columns where TABLE_NAME = 'your table name' order by ordinal_position;
pt-query-digest slow.log > digest.log
#分析日志中的UserAgent
cat access_20130704.log | awk -F "\"" '{print $(NF-3)}' | sort | uniq -c | sort -nr | head -20
#上面的脚本将分析出日志文件中最多的20个UserAgent
#分析日志中那些IP访问最多
cat access_20130704.log | awk '{print $1}' | sort | uniq -c | sort -nr | head -20
#分析日志中那些Url请求访问次数最多
cat access_20130704.log | awk -F "\"" '{print $(NF-5)}' | sort | uniq -c | sort -nr | head -20
cd ~/www/albicilla/api
forever start -l ~/.forever/api.log -e ~/.forever/err.api.log -w -a app.js
cd ~/www/albicilla/public
forever start -l ~/.forever/public.log -e ~/.forever/err.public.log -w -a app.js
select substring_index(substring(field_name, instr(field_name, "@")+1), " ", 1)
var str = 'asdfasflasjfasjfasfapple;asdfasfasfas';
var keyword = 'apple';
if(str.search(new RegExp(keyword, 'i')) == -1){
alert('Found ' + keyword);
}