Skip to content

Instantly share code, notes, and snippets.

View scionoftech's full-sized avatar

Sai Kumar Yava scionoftech

  • Hyderabad, India
View GitHub Profile
@scionoftech
scionoftech / roundrobinmatches.py
Created August 23, 2019 08:07
This a python script for generating roundrobin matches for sporting events
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)
@scionoftech
scionoftech / How to publish python packages to pypi
Created August 20, 2019 18:57
How to publish python packages to pypi
# 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/*
@scionoftech
scionoftech / Send_Email_Python
Created July 31, 2019 12:07
A simple python script to send email
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"
@scionoftech
scionoftech / pdf2excel.py
Last active February 17, 2025 04:27
this is a python script to extract tables from pdf and convert to excel
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 = []
@scionoftech
scionoftech / pdf_form_reader.py
Last active June 14, 2019 07:28
this is a python script for reading pdf forms
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)
@scionoftech
scionoftech / image_read.py
Created June 14, 2019 07:09
This is a python script to read text from image using tesseract ocr
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)
@scionoftech
scionoftech / watchdog_sample.py
Created June 13, 2019 13:25
this is a python script to mointor a folder for changes
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):