This file contains 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
import time | |
import os | |
import shutil | |
from watchdog.observers import Observer | |
from watchdog.events import FileSystemEventHandler | |
class StartMonitor(FileSystemEventHandler): | |
def __init__(self, monitor_path, move_path): |
This file contains 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
from PIL import Image | |
import numpy as np | |
import pytesseract | |
# pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe" | |
original = Image.open(IMAGE_PATH) | |
#original.show() | |
img = np.array(original) |
This file contains 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
import json | |
from pdfminer.pdfparser import PDFParser | |
from pdfminer.pdfdocument import PDFDocument | |
from pdfminer.pdftypes import resolve1 | |
fp = open(PDF_FILE_PATH, 'rb') | |
parser = PDFParser(fp) | |
doc = PDFDocument(parser) | |
print(doc) |
This file contains 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
import click | |
from pathlib import Path | |
import pdfplumber | |
import pandas as pd | |
from pandas import ExcelWriter | |
def to_excel(path, output_path): | |
with pdfplumber.open(path) as pdf: | |
data = [] |
This file contains 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
import smtplib | |
""" | |
SMTP Server Information | |
1. Gmail.com: smtp.gmail.com:587 | |
2. Outlook.com: smtp-mail.outlook.com:587 | |
3. Office 365: outlook.office365.com | |
Please verify your SMTP settings info. | |
""" | |
FROM = "YOUR EMAIL ID" |
This file contains 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
# this will create archive files | |
python setup.py sdist | |
# install twine | |
pip install twine | |
# https://test.pypi.org | |
twine upload --repository-url https://test.pypi.org/legacy/ dist/* | |
# https://pypi.org | |
twine upload dist/* |
This file contains 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
from itertools import combinations | |
from operator import itemgetter | |
def getroundrobinmatches(participants): | |
rounds = participants-1 if participants%2 == 0 else participants | |
data = list(range(1,participants+1)) | |
comb = combinations(data, 2) |
This file contains 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
***** round robin macthes ***** | |
(Even number participants) | |
---------- | |
n = no of participants | |
matches = n(n-1)/2 | |
rounds = n-1 | |
byes = 0 | |
Eg. | |
participants = 10 |
This file contains 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
from PIL import Image as pillowimg | |
import numpy as np | |
import cv2 | |
import pytesseract | |
# PIL image | |
def check_orientation(img): | |
newdata = pytesseract.image_to_osd(np.array(img)) | |
orgi_orientation = re.search('(?<=Rotate: )\d+', newdata).group(0) | |
# check image orientation | |
if orgi_orientation != 0: |
This file contains 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
# https://en.wikipedia.org/wiki/Python_(programming_language) | |
# https://www.mediawiki.org/wiki/API:Main_page | |
# 1. Get a plain text representation of either the entire page or the page "extract" straight from the API with the extracts prop | |
# Note that this approach only works on MediaWiki sites with the TextExtracts extension. This notably includes Wikipedia, but not some smaller Mediawiki sites like, say, http://www.wikia.com/ | |
# You want to hit a URL like | |
# https://en.wikipedia.org/w/api.php?action=query&format=json&titles=Bla_Bla_Bla&prop=extracts&exintro&explaintext |
OlderNewer