This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = 'asdfasflasjfasjfasfapple;asdfasfasfas'; | |
var keyword = 'apple'; | |
if(str.search(new RegExp(keyword, 'i')) == -1){ | |
alert('Found ' + keyword); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select substring_index(substring(field_name, instr(field_name, "@")+1), " ", 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#分析日志中的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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pt-query-digest slow.log > digest.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select column_name from information_schema.columns where TABLE_NAME = 'your table name' order by ordinal_position; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Linux | |
stat -c %a [file or directory path] | |
## Mac OS X | |
stat -f "%Lp" [filename] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# login to mysql client as root | |
GRANT ALL PRIVILEGES ON *.* TO '[user name]'@'localhost' IDENTIFIED BY '[password]' WITH GRANT OPTION; | |
GRANT ALL PRIVILEGES ON *.* TO '[user name]'@'%' IDENTIFIED BY '[password]' WITH GRANT OPTION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='your_database_name' AND `TABLE_NAME`='your_table_name'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm update npm -g |
OlderNewer