This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ = 'giasuddin' | |
| import html | |
| data = {"description":"><img src=x onerror=prompt(1)>", | |
| } | |
| def sanitizeHtmlText(**kwargs): | |
| """ | |
| python sanitize string. is there any script, sql tag in string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ = 'giasuddin' | |
| from PIL import Image | |
| import os, sys | |
| size = (250, 500) | |
| path = "/home/giasuddin/script/imgresize/all" | |
| dirs = os.listdir(path) | |
| directory = '/home/giasuddin/script/imgresize/dr' | |
| # os.makedirs(directory) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def dict_merge(): | |
| """ | |
| merge two dictionary | |
| :return: | |
| """ | |
| dict_a = {'a':1, 'b': 2} | |
| dict_b = {'b':10, 'c': 11} | |
| z = dict_a.copy() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ = 'giasuddin' | |
| test_html=""" <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Page Title</title> | |
| </head> | |
| <body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #-*- 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ = 'giasuddin' | |
| from subprocess import call | |
| call(["ls"]) | |
| call(["sudo apt-get update"]) | |
| call(["sudo apt-get upgrade"]) | |
| call(["dir"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pre rehnquist: | |
| # >psycopg2 | |
| # >python version 3.* | |
| #> SQLAlchemy | |
| # | |
| # Outcome: | |
| # >using Sqlalchemy create table and call data from database | |
| # >Table sync in postgresql | |