Skip to content

Instantly share code, notes, and snippets.

@vinovator
vinovator / pptPlay.py
Last active April 9, 2025 03:38
Creating & editing PPT documents using python-pptx module
# pptPlay.py
# Python 2.76
# Importing python-pptx module
from pptx import Presentation
# This is the template based on which PPT will be created
# If None is passed then blank ppt with no slides will be created
PPT_TEMPLATE = None
@vinovator
vinovator / tktk.py
Last active December 8, 2015 22:31
Tinkering with Tkinter
# tktk.py
# Python 2.7.6
"""
A simple form that prompts for name and prints it back
"""
import Tkinter as tk # use "tkinter" for python 3.x
# All widgets belong to a parent which is defined first
@vinovator
vinovator / extractXmlFromXL.py
Last active December 10, 2015 17:36
Script to download all xml files from the urls specified in the excel report. Requires requests, tkinter and openpyxl modules
# Python 2.7.6
# extractXmlFromXl.py
"""
Script to download all xml files from the urls specified in the excel report
Requires requests and openpyxl modules
"""
import requests
from requests.auth import HTTPDigestAuth # To access url with digest authentication
@vinovator
vinovator / myDecorator.py
Last active December 17, 2015 22:56
A simple decorator example in python
# python 2.7.6
# myDecorator.py
"""
A simple decorator example in python
"""
class SimpleClass:
"""
A simple class with add and subtract methods, undecorated
@vinovator
vinovator / RateCalculator.py
Last active December 18, 2015 16:04
A python program that makes use of decorator. Our imaginary software consultant/ contractor uses this program to generate invoice for his various services
# RateCalculator.py
# Python 2.7.6
"""
A python program that makes use of decorator. Our imaginary software
consultant/ contractor uses this program to generate invoice for his
various services
"""
@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)
@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 / OutlookMailer.py
Last active March 6, 2025 14:32
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 / 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 / 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