Skip to content

Instantly share code, notes, and snippets.

View jamesshah's full-sized avatar

james shah jamesshah

View GitHub Profile
@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

def send_attendance(url, data):
"""It takes google form url which is to be submitted and also data which is a list of data to be submitted in the form iteratively."""
for d in data:
try:
requests.post(url, data=d)
print("Form Submitted.")
time.sleep(5)
except:
print("Error Occured!")
def get_values():
"""It returns a list of different form data to be submitted by send_attendance method.
subjects_time is a dictionary with Day as keys and time and subjects in a list as values.
value_list is a list of lectures' subject and time of current_day."""
values_list = []
now = datetime.datetime.now()
day_name = now.strftime("%A")
subjects_time = {
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)"]],
}
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
@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.