Skip to content

Instantly share code, notes, and snippets.

View ShahriyarR's full-sized avatar

Shahriyar Rzayev ShahriyarR

View GitHub Profile
## Activating Several Crucial Linux Repos:
## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ##
"""
Shahriyar Rzayev, rzayev.sehriyar@gmail.com
Written in Python 3 using shutil.make_archive. (Tested with Python 3.3.5)
Purpose of class to create tar.gz archive files.
General usage is to create crontab, for archiving log files or another .zip files, to one archive file.
After All usage process there will be created zip_archive.tar.gz file.
Compression level: Default
"""
Written in Python 3.
Running JAR file within Python file.
Especially for DWH super boy (after Shahmaddin) Rahim's JAR file (mail sender) :D :D
Using Oracle cx_Oracle library + Python 3's subprocess.Popen
"""
import cx_Oracle
@ShahriyarR
ShahriyarR / grep.txt
Last active August 29, 2015 14:00
GREP usage
1. # Searching for a single whole word in file #
# Note: Case Sensitive search
grep "InnoDB" logfile.log
2014-04-22 15:36:22 1022 [Note] Shutting down plugin 'InnoDB'
2014-04-22 15:36:22 1022 [Note] InnoDB: FTS optimize thread exiting.
2014-04-22 15:36:22 1022 [Note] InnoDB: Starting shutdown...
2014-04-22 15:36:24 1022 [Note] InnoDB: Shutdown completed; log sequence number 1626077
2. # Searching and counting match in file #
@ShahriyarR
ShahriyarR / awk.txt
Last active August 29, 2015 14:00
AWK usage
1. # Sadece Butun logfile-i oxuyur print edir.
awk '{print $0}' logfile.log --- print the entire line.
2. # Her setrden ilk column, field-i cixardir
awk '{print $1}' logfile.log
3. # Ilk olaraq 2ci field daha sonra 1ci field-i cixardir
awk '{print $2,$1}' logfile.log
4. # Regex-den istifade etmekle search
@ShahriyarR
ShahriyarR / sed.txt
Created May 1, 2014 13:56
SED usage
1. # Print first line
sed -n '1p' apa_az_news.sql
2. # Print last line
sed -n '$p' apa_az_news.sql
import mysql.connector
from mysql.connector import Error
try:
cnx = mysql.connector.connect(user='remote2', password='Pass@123#', host='192.168.1.77', database='world')
except Error as err:
print err
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