Skip to content

Instantly share code, notes, and snippets.

View harveyqing's full-sized avatar

harvey harveyqing

  • Beijing, China
View GitHub Profile
@harveyqing
harveyqing / Nginx - debug specified client.md
Last active March 31, 2018 03:00
show how to debug specified clients in Nginx.

e.g.

events {
    debug_connection 10.224.66.14;
    debug_connection 10.224.57.0/24;
}

P.S. --with-debug option should be on during configure phase

set debug option:
error_log path/to/err/log debug;
P.S. Should config the ``--with-debug`` option during configure phase.
@harveyqing
harveyqing / Re. match `2014-03-17 09:33:59` format like timestramp
Created March 17, 2014 01:36
Re. match `2014-03-17 09:33:59` format like timestramp
import re
tp = re.compile(r'^(\d{4})-([1-9]|0[1-9]|1[0-2])-([1-9]|[1-2]\d|3[0-1]) (\d|0\d|1[0-2]|1\d|2[0-3]):(\d|[0-5]\d):(\d|[0-5]\d)$')
# can match string timestamps like below
# t1 = '3003-1-1 9:03:59
@harveyqing
harveyqing / All fields in a specified table
Created March 15, 2014 03:46
Retrive all fields in a specified table
Syntax:
mysql> SHOW FULL COLUMNS FROM DBname.table_name
Head description:
Field :field name
Type:field type
Collation:char set (above mysql 5.0)
Null :can be `NULL` of not
Key:index(PRI,unique,index)
@harveyqing
harveyqing / dump & backup
Last active August 29, 2015 13:57
A description of how to dump & backup mysql data in CLI.
* Export a whole database:
Syntax:
mysqldump -u username -p [pwd] DBname > /path/to/backup
* Export a table in a specified database:
Syntax:
mysqldump -u username -p [pwd] DBname table_name > /path/to/backup