Skip to content

Instantly share code, notes, and snippets.

View MeherajUlMahmmud's full-sized avatar

Meheraj MeherajUlMahmmud

View GitHub Profile
digits = [
'০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯',
]
vowels = [
'অ', 'আ', 'ই', 'ঈ', 'উ', 'ঊ', 'ঋ', 'এ', 'ঐ', 'ও', 'ঔ',
]
consonants = [
'ক', 'খ', 'গ', 'ঘ', 'ঙ', 'চ', 'ছ', 'জ', 'ঝ', 'ঞ', 'ট', 'ঠ', 'ড', 'ঢ', 'ণ', 'ত', 'থ', 'দ', 'ধ', 'ন', 'প', 'ফ', 'ব',
'ভ', 'ম', 'য', 'র', 'ল', 'শ', 'ষ', 'স', 'হ', 'ড়', 'ঢ়', 'য়', 'ৎ', 'ং', 'ঃ', 'ঁ',
]
@MeherajUlMahmmud
MeherajUlMahmmud / levenshtein_distance.py
Created November 16, 2023 09:13
The Levenshtein distance, also known as the edit distance, measures the minimum number of single-character edits required to transform one string into another. These edits can be insertions, deletions, or substitutions.
def levenshtein_distance(str1, str2):
m, n = len(str1), len(str2)
# Initialize a matrix to store distances
dp = [[0] * (n + 1) for _ in range(m + 1)]
# Fill the matrix with base cases
for i in range(m + 1):
for j in range(n + 1):
if i == 0:
@MeherajUlMahmmud
MeherajUlMahmmud / pad_image.py
Created July 24, 2023 09:34
This script will pad an image with the common color. It will add extra space on all four sides of an image
import cv2
import numpy as np
def pad_image(image, padding_percent):
"""
Pad the image and return it
:param image: Numpy array
:param padding_percent: float
:return: padded_image: Numpy array
"""
@MeherajUlMahmmud
MeherajUlMahmmud / Airplane Seatplan.js
Last active January 1, 2023 06:45
Airplane Seatplan
var seatplan = [
[3, 4],
[4, 5],
[2, 3],
[3, 4],
];
// var seatplan = [
// [3, 2],
// [4, 3],
// [2, 3],
Future pickDateTime(BuildContext context) async {
final date = await pickDate(context);
if (date == null) return;
final time = await pickTime(context);
if (time == null) return;
setState(() {
dateTime = DateTime(
# Reading the dataset
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('SimpleLinearRegression.csv')
df.columns = ['YearsExperience', 'Salary']
X = df['YearsExperience']
y = df['Salary']
def multiply(mat1, mat2):
row1 = len(mat1)
col1 = len(mat1[0])
rows2 = len(mat2)
col2 = len(mat2[0])
result = zeros(row1, col2)
if (len(mat1[0]) != len(mat2)):
print('The two matrices cannot be multiplied')
def subtract(mat1, mat2):
row1 = len(mat1)
col2 = len(mat2[0])
result = zeros(row1, col2)
for i in range(row1):
for j in range(col2):
result[i][j] = mat1[i][j] - mat2[i][j]
def add(mat1, mat2):
row1 = len(mat1)
col2 = len(mat2[0])
result = zeros(row1, col2)
for i in range(row1):
for j in range(col2):
result[i][j] = mat1[i][j] + mat2[i][j]
def identity(n):
mat = zeros(n, n)
for i in range(n):
mat[i][i] = 1
return mat
mat = identity(3)