Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / UdacityDownload.py
Last active July 28, 2023 05:03
Python program to download course content for multiple Udacity courses neatly arranged within a folder structure
# UdacityDownload.py
# Python 2.7.6
"""
Python script to download course content from udacity courses
- Creates folders as per course names
- Downloads all the zip files
- Extract content from zip file
- Finally delete the zip file
Multiple course content can be downloaded from list
@vinovator
vinovator / keywordExtractor.py
Created January 11, 2016 13:30
Extract keywords from a text by eliminating stop words, punctuations etc
# keywordExtractor.py
# Python 2.7.6
import requests
import re
from collections import Counter
"""
Step 1: Obtain Text
Step 2: Strip punctuation, special characters, etc.
@vinovator
vinovator / OutlookMailer.py
Last active February 3, 2021 07:46
Sending mail from local machine using Python and win32com.client library
# OutlookMailer.py
# Python 2.7.6
import win32com.client as com
outlook = com.Dispatch("Outlook.Application")
"""
Source - https://msdn.microsoft.com/en-us/library/office/ff869291.aspx
Outlook VBA Reference
@vinovator
vinovator / Cricinfoscraper_py2.py
Last active January 21, 2016 13:57
Simple webscraper to download cartoon strips from cricinfo site.
# python 2.7.6
# Cricinfoscraper_py2.py
"""
Simple webscraper to download cartoons from cricinfo site.
The url is http://www.espncricinfo.com/ci/content/story/author.html?author=333
Changed the code to dynamically scroll the page to fetch more cartoons.
Using Splinter/ Selenium library to fetch javascript rendered content
"""
@vinovator
vinovator / gistsDownloader.py
Created December 20, 2015 12:57
Download all gists from a specific user
# gistsDownloader.py
# Python 3.4
import requests
username = "vinovator"
url = "https://api.github.com/users/" + username + "/gists"
resp = requests.get(url)