Skip to content

Instantly share code, notes, and snippets.

View jamesshah's full-sized avatar

james shah jamesshah

View GitHub Profile
@jamesshah
jamesshah / quotes.py
Last active October 1, 2019 13:57
Random Quote Generator And Send Using Email | Python Web Scrapping Using BeautifulSoup
import requests, random
from bs4 import BeautifulSoup
import smtplib
#Function to generate a random quote.
def random_quote(url):
conn = requests.get(url)
soup = BeautifulSoup(conn.content,'html.parser')
quotes = soup.find_all('a', attrs={"title": "view quote"})
quotesList = []
@jamesshah
jamesshah / automation.sh
Created October 5, 2019 08:44
Project Initialization Automation using Python And Shell Script
#!/bin/bash
#shell script to automate project initialization
function create(){
cd
python ./automation1.py $1
cd path/to/your/projects/directory/$1
touch Readme.md
git init
git add .
git commit -m "first commit"
@jamesshah
jamesshah / LinkedList.java
Last active October 21, 2019 19:04
Linked List Implementation in Java
//Implementing Singly Linked List in Java
class LinkedList{
Node head; //Reference to the Node class to create head node of the list.
//Node class to create nodes. here we make static class so that main method
//can recoginze it.
static class Node{
int data;
Node next;
@jamesshah
jamesshah / MatrixAddition.java
Last active October 21, 2019 19:06
Implementing Arrays in Java.
//Implementing Matrix Addition
class MatrixMultiplication{
public static void main(String[] args) {
//Creating two matrices
int[][] a = {{1,2,3},{2,3,4}};
int[][] b = {{1,2,3},{2,3,4}};
//Creating empty matrix to store the result
int[][] sum = new int[2][3];
#!/bin/bash
#shell script to automate project initialization.
function create(){
cd
python ./automation1.py $1
cd path/to/your/projects/directory/$1
touch Readme.md
git init
git add .
git commit -m "first commit"
@jamesshah
jamesshah / automation.py
Last active November 11, 2019 11:12
Automation Of Project Initialization Using (Python + Shell Script)
import sys
import os
from github import Github
path = "/path/to/your/desired/projects/directory"
def create():
folder_name = str(sys.argv[1])
os.makedirs(path+folder_name)
username = #your github username
board_keys = []
for key in theBoard:
board_keys.append(key)
restart = input("Do want to play Again?(y/n)")
if restart == "y" or restart == "Y":
for key in board_keys:
theBoard[key] = " "
@jamesshah
jamesshah / python_excel.py
Last active December 31, 2019 14:35
Reading and Writing Data to and from Excel sheet in python using OpenPyxl.
# Read words from an existing excel sheet and find distant words and write it into a new excel sheet.
import openpyxl
distant_words = []
all_words = []
def get_all_words(filename, all_words):
'''Takes an excel sheet and an empty list as inputs and
returns the list of all words(values of cells) from all the columns.
values = {
# Email Address
"emailAddress": str(sys.argv[1]),
# Enrollment Number
"entry.33987362": str(sys.argv[2]),
# Course
"entry.363926033": "BE",
# Branch
"entry.733518766": "IT",
# Semester
subjects_time = {
"Monday": [["10", "30", "AJ(HC)"], ["11", "30", "DCDR(PC)"], ["1", "00", "WT(AM)"], ["2", "00", "SE(KD)"]],
"Tuesday": [["11", "30", "SE(KD)"], ["1", "00", "AJ(HC)"]],
"Wednesday": [["11", "30", ".NET(PC)"], ["1", "00", "SE(KD)"], ["2", "00", ".NET(PC)"]],
"Thursday": [["10", "30", "WT(AM)"], ["11", "30", "DCDR(PC)"], ["1", "00", "AJ(HC)"]],
"Friday": [["10", "30", "AJ(HC)"], ["11", "30", ".NET(PC)"], ["1", "00", "SE(KD)"], ["2", "00", ".NET(PC)"]],
}