Skip to content

Instantly share code, notes, and snippets.

View mayankt18's full-sized avatar
🎯
Focusing

Mayank Thakur mayankt18

🎯
Focusing
View GitHub Profile
import sys
def getCostMatrix():
numRows = int(input('Enter the number of sources : '))+1
numCols = int(input('Enter the number of destinations : '))+1
costMatrix = []
for i in range(numRows-1):
rowCostArray=list(map(int, input('Enter the costs for source %s and the total supply at the end, separated by space\n'%(i+1)).split()))
costMatrix.append(rowCostArray)
rowCostArray = list(map(int, input('Enter the demand values for each destination separated by space\n').split()))
costMatrix.append(rowCostArray)
import requests
def asteroidOrbits(year, orbitclass):
r=requests.get("https://jsonmock.hackerrank.com/api/asteroids/search?page="+str(1)).json()
total_pages=r["total_pages"]
list=[]
for i in range(1,total_pages+1):
req=requests.get("https://jsonmock.hackerrank.com/api/asteroids/search?page="+str(i)).json()
for j in req["data"]:
if(str(year)==j["discovery_date"][:4]and orbitclass.lower() in j["orbit_class"].lower()):
/* AAROHAN NAVBAR => ARNAV*/
.curpo{cursor: pointer;}
.fade-zoom{
animation: wdct-special 0.5s ease;
transition: 0.5s;
}
.bg-transparent{
background: #060936 !important;

Hosting Online Judge

Hosting the Backend of Online Judge

  • Create a new user named oj_main and add it to sudo group
sudo adduser oj_main
sudo usermod -aG sudo oj_main
su oj_main
@mayankt18
mayankt18 / fancy-slider.markdown
Created February 28, 2022 17:17
Fancy Slider

Fancy Slider

Based on dribbble shot by Kreativa Studio - https://dribbble.com/shots/2375246-Fashion-Butique-slider-animation

Fullscreen please. Looks best in Webkit browsers, because clip-path not working in FF/IE without SVG fallbacks, which I don't want to use in this demo. Not responsive atm, I will figure out something soon.

Features:

  1. Clip-path for image masking rectangle border (webkit only).
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fo(i,n) for(i=0;i<n;i++)
#define fl(i,l,n) for(i=l;i<n;i++)
#define pb push_back
#define strev(a, b) sort(a, b, greater<>())
@mayankt18
mayankt18 / Deploy.md
Last active March 8, 2023 18:10
Deploy using nginx and gunicorn and install ssl

Deploy with nginx and gunicorn

  1. Clone and run your project
  2. sudo apt update
  3. sudo apt install python3-pip python3-dev nginx
  4. sudo pip3 install virtualenv
  5. python3 -m venv env
  6. source ./env/bin/activate
  7. pip install gunicorn
  8. deactivate

Query Preprocessing

To preprocess your text simply means to bring your text into a form that is predictable and analyzable for your task. Whenever we have textual data, we need to apply several pre-processing steps to the data to transform words into numerical features that work with machine learning algorithms.

For preprocessing in python, we will be using NLTK(Natural Language Toolkit), string and regex packages.

Basic Preprocessing Techniques

  1. Lowercasing : Lowercasing the text reduces the size of the vocabulary of our text data. Lowercasing helps to solve sparsity issues. Example:

The Web App

We are going to make the web app using flask library in python. There will be two pages one the homepage and the other the search results page.

Basic structure of the web application:


"""
Program to crawl the specified url with given depth
"""
from bs4 import BeautifulSoup
import requests
import pymongo
import urllib.parse
import sys