Skip to content

Instantly share code, notes, and snippets.

@1901
1901 / speedtest-cli.sh
Created May 11, 2019 11:02
[speedtest-cli] #network #linux #curl
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
@1901
1901 / clearcache.sh
Last active July 1, 2019 12:11
[linux_clear_memory_cache] #linux
# 1. Clear PageCache only.
sync; echo 1 > /proc/sys/vm/drop_caches
# 2. Clear dentries and inodes.
sync; echo 2 > /proc/sys/vm/drop_caches
# 3. Clear PageCache, dentries and inodes.
sync; echo 3 > /proc/sys/vm/drop_caches
# If you want to clear Swap space, you may like to run the below command.
@1901
1901 / nginx_log_format.conf
Last active October 14, 2019 10:15
[nginx log_format config] #nginx #config
log_format main '$remote_addr [$time_local][$host] '
'request="$request" '
'request_length=$request_length '
'status=$status bytes_sent=$bytes_sent '
'body_bytes_sent=$body_bytes_sent '
'referer=$http_referer '
'user_agent="$http_user_agent" '
'upstream_addr=$upstream_addr '
'upstream_status=$upstream_status '
'request_time=$request_time '
@1901
1901 / install_nethogs.sh
Created March 22, 2019 14:53
[CentOS 6.x install nethogs] #network #linux
# if not install epel-release
rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/n/nethogs-0.8.5-1.el6.x86_64.rpm
@1901
1901 / mysql_commands.sql
Last active February 19, 2020 03:45
[MySQL commands] #linux #mysql
-- 创建只读账号 (% 表示不限制 IP 登录)
GRANT SElECT ON *.* TO 'reader'@'%' IDENTIFIED BY "password";
-- 查看 test 数据库下每张表的大小
SELECT TABLE_NAME, DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES where TABLE_SCHEMA='test';
-- Export database schema
mysqldump -u user -p -h host --no-data dbname > dbname_schema.sql
-- 备份数据库并打包成 gz 格式
@1901
1901 / curl.sh
Created November 20, 2018 12:37
[curl] #linux #curl #network
# 使用指定的 Host 访问某个地址
curl -w "@curl_format.txt" -H 'Host: www.baidu.com' 'http://127.0.0.1'
# 用于分析请求耗时
curl -w "@curl_format.txt" 'http://127.0.0.1'
# 设置超时
curl --connect-timeout 1 --max-time 3 "http://www.baidu.com"
@1901
1901 / nginx_crossdomain.conf
Created November 15, 2018 05:50
[Nginx 跨域配置] #nginx #linux
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
@1901
1901 / ip_api.sh
Last active February 12, 2020 03:42
[IP API] #network
curl ip.cn
curl us.ip.cn
curl ip.sb
curl cip.cc
curl cip.cc/1.1.1.1
curl myip.ipip.net
curl ipinfo.io
curl ifconfig.me
@1901
1901 / adb.sh
Created November 12, 2018 10:47
[adb] #android #adb
adb shell am start -W -a android.intent.action.VIEW -d "https://main.sea.camexgame.com/instant"
adb shell am start -W -a android.intent.action.VIEW -d "https://instant.app/com.camex.tactical.monsters"
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://play.google.com/store/apps/details?id=com.camex.tactical.monster&launch=true"
@1901
1901 / nginx_return_code_content.cfg
Last active November 10, 2018 13:47
[Nginx 直接返回内容] #nginx #linux
location = /test {
add_header Content-Type text/plain;
return 200 'proxy-4001';
}