Skip to content

Instantly share code, notes, and snippets.

@vinovator
vinovator / pwdhash.py
Created January 26, 2016 14:16
Best practice for securely hashing passwords
# pwdhash.py
# Python 2.7.6
import uuid
import hashlib
"""
source - http://pythoncentral.io/hashing-strings-with-python/
"""
@vinovator
vinovator / checksumGenerator.py
Last active January 27, 2016 15:13
Script to generate MD5 checksum for a given file. Uses iterator implementation.
# checksumGenerator.py
# Python 2.7.6
"""
Script to generate MD5 checksum for a given file
Also see comparison of performance with iterator implementation
"""
import hashlib
import time
@vinovator
vinovator / simpleLP1.py
Last active March 24, 2022 18:38
Python script to solve Linear Programming problems using PuLP library
# simpleLP1.py
# Python 2.7.6
"""
Python script to solve Linear Programming problems
Uses Pulp library
Problem statement: (src - http://fisher.osu.edu/~croxton.4/tutorial/)
1) Objective Function -
@vinovator
vinovator / simpleLP2.py
Last active August 23, 2022 02:45
Python script to solve Linear Programming problems using pulp library
# simpleLP2.py
# Python 2.7.6
"""
Python script to solve Linear Programming problems
Uses Pulp library
Problem statement: (src - http://fisher.osu.edu/~croxton.4/tutorial/)
ChemCo produces two fertilizers, FastGro and ReallyFastGro. Each is made of
a mix of two growth agents. FastGro is a 50/50 mix of the two, and it sells
@vinovator
vinovator / ChecksumGeneratorV2.py
Created January 28, 2016 11:29
Generate MD5 checksum for all files placed under a folder
# ChecksumGeneratorV2.py
# Python 2.7.6
"""
Generate MD5 checksum for all files placed under a folder
"""
import hashlib
import os
@vinovator
vinovator / checkDuplicates.py
Last active July 28, 2025 18:29
Python script to find duplicate files from a folder
# checkDuplicates.py
# Python 2.7.6
"""
Given a folder, walk through all files within the folder and subfolders
and get list of all files that are duplicates
The md5 checcksum for each file will determine the duplicates
"""
import os
@vinovator
vinovator / imapMailboxMiner.py
Last active December 16, 2024 10:37
Python script to mine IMAP Mail servers, such as yahoo, gmail etc. Edit the IMAP server name to mine a particular mail service.
# imapMailboxMiner.py
# Python 2.7.6
"""
Connect to IMAP4 server and fetch mails
http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
"""
import imaplib # Library to interact with IMPAP server
import sys
@vinovator
vinovator / tk_PromptPassword.py
Last active October 18, 2020 13:50
Reusable library which pops tkinter window to prompt password
# tk_PromptPassword.py
# Python 2.7.6
"""
Reusable library which pops tkinter window to prompt password
"""
import Tkinter as tk
import tkMessageBox as tkm # To show warning/ error messages
import logging
@vinovator
vinovator / PdfAdapter.py
Created February 25, 2016 17:23
Reusable library to extract text from pdf file
# Python 2.7.6
# PdfAdapter.py
""" Reusable library to extract text from pdf file
Uses pdfminer library; For Python 3.x use pdfminer3k module
Below links have useful information on components of the program
https://euske.github.io/pdfminer/programming.html
http://denis.papathanasiou.org/posts/2010.08.04.post.html
"""
@vinovator
vinovator / world_t20_itinerary.py
Last active March 4, 2016 16:54
Scrap Workd T20 schedule from ICC website using BeautifulSoup & Requests and format the excel output
# world_t20_itinerary.py
# Python 2.7.6
"""
Scrap Workd T20 schedule from ICC website using BeautifulSoup & Requests
Load the schedule into an excel file using pandas
Format the excel file using openpyxl
- Apply border, wrap text and color headers
- Highlight India matches
"""