Skip to content

Instantly share code, notes, and snippets.

View fesgic's full-sized avatar
🖥️
going blue

Festus Gichohi fesgic

🖥️
going blue
View GitHub Profile
@madan712
madan712 / export_db_csv.py
Created June 27, 2019 20:12
Python - Export database table to csv file
import mysql.connector
def fetch_table_data(table_name):
# The connect() constructor creates a connection to the MySQL server and returns a MySQLConnection object.
cnx = mysql.connector.connect(
host='localhost',
database='schema',
user='user',
password='password'
@markito
markito / hashSHASalt.py
Created July 28, 2017 03:18
Hashing using SHA256/Salt in Python
import uuid
import hashlib
def hashText(text):
"""
Basic hashing function for a text using random unique salt.
"""
salt = uuid.uuid4().hex
return hashlib.sha256(salt.encode() + text.encode()).hexdigest() + ':' + salt