Skip to content

Instantly share code, notes, and snippets.

View jamesshah's full-sized avatar

james shah jamesshah

View GitHub Profile
@jamesshah
jamesshah / subtitles_downloader.py
Last active October 9, 2021 13:22
Python Script To Download Movie Subtitles | Webscrapping Using Python.
import webbrowser,requests,zipfile, io
from bs4 import BeautifulSoup
def subtitles_downloader():
try:
# Get Movie Name For Subtitles
movie_name = input("Enter Movie Name:")
#replacing spaces with hyphen to get valid link
@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 / 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];
@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 / 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
#!/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"
theBoard = {'7': ' ' , '8': ' ' , '9': ' ' ,
'4': ' ' , '5': ' ' , '6': ' ' ,
'1': ' ' , '2': ' ' , '3': ' ' }
def printBoard(board):
print(board['7'] + '|' + board['8'] + '|' + board['9'])
print('-+-+-')
print(board['4'] + '|' + board['5'] + '|' + board['6'])
print('-+-+-')
print(board['1'] + '|' + board['2'] + '|' + board['3'])
def game():
turn = 'X'
count = 0
for i in range(10):
printBoard(theBoard)
print("It's your turn," + turn + ".Move to which place?")
move = input()
# Now we will check if player X or O has won,for every move after 5 moves.
if count >= 5:
if theBoard['7'] == theBoard['8'] == theBoard['9'] != ' ': # across the top
printBoard(theBoard)
print("\nGame Over.\n")
print(" **** " +turn + " won. ****")
break
elif theBoard['4'] == theBoard['5'] == theBoard['6'] != ' ': # across the middle
printBoard(theBoard)
print("\nGame Over.\n")