Skip to content

Instantly share code, notes, and snippets.

View giasuddin90's full-sized avatar
🎯
Focusing

Gias Uddin giasuddin90

🎯
Focusing
View GitHub Profile
@giasuddin90
giasuddin90 / python_pdf_mnupulation
Created December 28, 2019 16:12
pdf existing file delete and add new pdf file
from PyPDF2 import PdfFileWriter, PdfFileReader
import requests
from io import BytesIO
import os
from io import StringIO
from WordpresFileUpload.wordpressFile import wordpress_file_up
def download_pdf(page_url, page_range):
"""
@giasuddin90
giasuddin90 / sqlalchemy_postgrasql_connection.py
Created October 30, 2019 11:32
Sqlalchemy and postgresql connection
# pre rehnquist:
# >psycopg2
# >python version 3.*
#> SQLAlchemy
#
# Outcome:
# >using Sqlalchemy create table and call data from database
# >Table sync in postgresql
from sqlalchemy import (
@giasuddin90
giasuddin90 / sqlalchemy_foreignkey_and_many_to_many_fied_join.py
Created October 30, 2019 11:31
Sqlalchemy foreignkey and many to many field joining
# pre rehnquist:
# >psycopg2
# >python version 3.*
#> SQLAlchemy
#
# Outcome:
# >using Sqlalchemy create table and call data from database
# >Table sync in postgresql
from sqlalchemy import (
# pre rehnquist:
# >psycopg2
# >python version 3.*
#> SQLAlchemy
#
# Outcome:
# >using Sqlalchemy create table and call data from database
# >Table sync in postgresql
@giasuddin90
giasuddin90 / short_code_generation.py
Last active October 30, 2019 11:29
Generate python short code by using random library, We need short code for sms verification, user verification , mail verification, token service
__author__ = 'giasuddin'
import string
import random
def code_generator(size=6, chars=string.ascii_uppercase + string.digits):
"""
Generate python short code, We need short code for sms verification, user verification , mail verification, token service
:param size:
:param chars:
@giasuddin90
giasuddin90 / python_linux_command.py
Created October 30, 2019 11:19
using python sub process run linux command
__author__ = 'giasuddin'
from subprocess import call
call(["ls"])
call(["sudo apt-get update"])
call(["sudo apt-get upgrade"])
call(["dir"])
@giasuddin90
giasuddin90 / read_pdf_write_xlsx.py
Created October 30, 2019 11:16
By using python PyPDF2 and openpyxl library read data from pdf file and write data in xlsx file
#-*- coding: utf-8 -*-
import PyPDF2
from openpyxl import Workbook
def pypd():
pdfFileObj = open('principle of marketing.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
# allpage= pdfReader.numPages
pages = range(939, 959)
# pages = range(939, 940)
@giasuddin90
giasuddin90 / py_file_read_by_extension.py
Created October 30, 2019 11:13
Python read file from a directory by using file extension
__author__ = 'giasuddin'
import os
import fnmatch
images = ['*.css', '*.jpeg', '*.ico', '*.gif', '*.png']
file_path= '/home/giasuddin/pyramid_sites/test//css'
for (dirpath, dirnames, filenames) in os.walk(file_path):
for extensions in images:
for filename in filenames:
if fnmatch.fnmatch(filename, extensions):
print(filename)
@giasuddin90
giasuddin90 / html_mail_script.py
Created October 30, 2019 11:11
Python html script mail by using third party mail server
__author__ = 'giasuddin'
test_html=""" <!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
@giasuddin90
giasuddin90 / python_password_encryption.py
Created October 30, 2019 11:06
python password encryption by salt. some time we need encryption for password or other thin for your software then we can use hashlb and shah512 for encryption. Encryption is needed for security, you have lot of option to encryption your password, i am just giving simple way to encryption password.
__author__ = 'giasuddin'
import hashlib
'''
some time we need encryption for password or other thin for your software then we can use hashlb and shah512 for encryption.
Encryption is needed for security, you have lot of option to encryption your password, i am just giving simple way to encryption password.
'''
def password_encyption(password):