Skip to content

Instantly share code, notes, and snippets.

View jamesshah's full-sized avatar

james shah jamesshah

View GitHub Profile
@jamesshah
jamesshah / tictactoe.py
Last active March 28, 2022 07:06
TicTacToe Game implemented in python3
#Implementation of Two Player Tic-Tac-Toe game in Python.
''' We will make the board using dictionary
in which keys will be the location(i.e : top-left,mid-right,etc.)
and initialliy it's values will be empty space and then after every move
we will change the value according to player's choice of move. '''
theBoard = {'7': ' ' , '8': ' ' , '9': ' ' ,
'4': ' ' , '5': ' ' , '6': ' ' ,
'1': ' ' , '2': ' ' , '3': ' ' }
# 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")
@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
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()
@jamesshah
jamesshah / bookList.dart
Created August 9, 2020 05:58
MCWC Practical 6
final String mcwc = "MCWC";
final String ins = "INS";
final String dmbi = "DMBI";
String book;
final List<String> mcwcList = [
'Wireless Communications & Networks by Pearson',
'Mobile ComputingTechnology,Applications and service creation by TMH',
'Android Application Development Black Book by dreamtech press',
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@jamesshah
jamesshah / node-express3.md
Last active April 21, 2020 05:30
Building A Node.js - Express App (covid19-updates) | Part - 3

If you haven't read the last post, I recommend you to check it out here, else many things in this post will not make sense.

In the previous post, we created database and user registration for our application and now in this post we'll add Twilio API to send SMS to users whenever they register successfully and we'll also add external API call to get the coronavirus data to send to our users. Lots of work to do!! So, let's get started.

Using Twilio API

Twilio provides many services ranging from SMS and Chat to AI Bots, Programmable SMS API being one of them. Using the Programmable Twilio SMS API we can add SMS service in our web application and that's exactly what we'll doing.

To use the Twilio SMS API,we need to create an account on Twilio website and buy a twilio number with SMS support. Twilio provides free number with some limitations. But luckily, As a p

@jamesshah
jamesshah / post2.md
Last active April 11, 2020 09:03
Building A Node.js - Express App (covid-19 updates) | Part - 2

If you haven't read the last post, I recommend you to check it out here, else many things in this post will not make sense.

In the last post we've created a simple index('/') route with HTML file as response using EJS template engine. Now, it's time to look into middlewares and how can we use them to serve our routes with the same prefix easily.So let's get started with the middlewares.


Middlewares

Middleware functions are functions that have access to the request object (req), the response object (res), and the next function in the application’s request-response cycle.The next function is a function in the Express router which, when invoked, executes the middleware succeeding the current middleware.

For example, let's say you have a route ('user/login') in your express app to login the user. Now you want to check the credentials given by users with the credentials stored in the database and authorize that user

@jamesshah
jamesshah / post1.md
Last active April 9, 2020 13:16
Building A Node.js - Express App (covid19-updates)

Covid19 Updates (Node.JS Express App)

Last week Dev.to announced a hackathon in collaboration with Twilio to make a web app using any of the Twilio API, So I decided to participate and build something in this quarantine time which will help me learn some new tech and build a project to showcase.

So I started brainstorming for an idea to create an app for and just then I heard my mother saying that we are privileged to have an Internet service which helps us getting latest news and updates in this Covid-19 lockdown period but for those who doesn't have this privilege, It's hard to get information about new cases in their state as well as in the country.And bingo!! I got the idea to create my web app.

I decided to create a web app in which user can register with their phone number once and they can get daily updates of new cases in their area as well as in the country with the help of Twilio Programmable SMS API

Deciding Tech-Stack