Skip to content

Instantly share code, notes, and snippets.

View tomatolog's full-sized avatar

Stas tomatolog

View GitHub Profile
@tomatolog
tomatolog / gist:8348545
Last active January 2, 2016 19:09 — forked from kevgs/gist:8343057
import MySQLdb
import sys
db = MySQLdb.connect(host='0', port=9306)
c = db.cursor()
for i in range(100):
print ( "pre limit " + sys.argv[1] + " " + datetime.datetime(1970, 1, 1) )
c.execute("""SELECT 1234, 1235 FROM goods_main limit %s""" % sys.argv[1])
print ( "pre limit " + sys.argv[1] + " " + datetime.datetime(1970, 1, 1) )
@tomatolog
tomatolog / tcpdump.txt
Created March 13, 2018 12:17 — forked from gstark/tcpdump.txt
Use tcpdump to monitor mysql
Use tcpdump to monitor mysql
# Capture the packets
sudo tcpdump -i eth0 port 3306 -s 0 -x -n -q -tttt -w tcpdump.out
# analyze all the requests from a given host
pt-query-digest --type=tcpdump --filter '($event->{host} || $event->{ip} || "") =~ m/192.168.248.64/' tcpdump.out