Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Harendra Kumar Kanojiya harendra21

🏠
Working from home
View GitHub Profile
View FileMan.py
# cook your dish here
import os
import time
from pathlib import Path
def createDir(BASE_DIR,dn):
for i in range(dn):
os.mkdir(BASE_DIR + str(i) + 'Folder')
View PDFdownloader.py
import urllib.request
def download(tutorialName):
url = 'https://www.tutorialspoint.com/' + tutorialName + '/' + tutorialName + '_tutorial.pdf'
downloadLocation = '<location>'
pdf = urllib.request.urlopen(url)
saveFile = open(downloadLocation + tutorialName + '.pdf', 'wb')
saveFile.write(pdf.read())
saveFile.close()
View AutoLinkedIn.py
from selenium import webdriver #connect python with webbrowser-chrome
from selenium.webdriver.common.keys import Keys
import pyautogui as pag
def main():
url = "http://linkedin.com/" #url of LinkedIn
network_url = "http://linkedin.com/mynetwork/" # url of LinkedIn network page
driver = webdriver.Chrome('F:\Argha\WebDriver\chromedriver.exe') # path to browser web driver
driver.get(url)
View Auto Whatsapp.py
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
target = str(input('Enter name of person/group you want to send message to:'))
string = str(input('Enter your message: '))
View Generate Password.py
from random import choice
from string import printable
def random_password(length):
"""
Provides a random password of the given length.
:param int length: The length of the password to generate.
"""
View File-Sharing-Bot.py
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import logging
import os
import telegram
import shutil
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
View select_file_pyqt.py
from PyQt5.QtWidgets import QFileDialog, QApplication
from PyQt5 import QtWidgets
def select_files(directory_location=None):
qtapp = QApplication([directory_location])
qtwgt = QtWidgets.QWidget()
filenames, _ = QFileDialog.getOpenFileNames(qtwgt)
return filenames
View select_file_tk.py
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename()
print(file_path)
View excel_to_list.py
import xlrd
import sys
class ExcelToList():
def __init__(self, file, sheet):
self.file = file
self.sheet = sheet
def convert(self):
View extended_ip_address_info.py
#!/bin/python
# -*- coding: utf-8 -*-
# Using curl to get data from https://ipinfo.io/json
# Template from pycurl documentation
# http://pycurl.io/docs/latest/quickstart.html#examining-response-headers
import pycurl #curl library
import certifi #HTTP over TLS/SSL library
from io import BytesIO #Buffered I/O implementation using an in-memory bytes buffer.