Skip to content

Instantly share code, notes, and snippets.

View tanviredu's full-sized avatar
:shipit:
Don't judge my github profile. i use it as a storage of everything

MD.Tanvir Rahman tanviredu

:shipit:
Don't judge my github profile. i use it as a storage of everything
View GitHub Profile
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(),"Images")),
RequestPath = "/Images"
});
data = ["eat","tea","tan","ate","nat","bat"]
print("INPUT : ",data)
def find_ord_sum(string):
res = []
for item in list(string):
res.append(ord(item))
return sum(res)
orw = []
for item in data:
orw.append(find_ord_sum(item))
@tanviredu
tanviredu / blazor-state-user-docs.md
Created October 30, 2020 01:33 — forked from SteveSandersonMS/blazor-state-user-docs.md
Preserving State in Server-Side Blazor applications

Preserving State in Server-Side Blazor applications

Server-side Blazor is a stateful application framework. Most of the time, your users will maintain an ongoing connection to the server, and their state will be held in the server's memory in what's known as a "circuit". Examples of state held for a user's circuit include:

  • The UI being rendered (i.e., the hierarchy of component instances and their most recent render output)
  • The values of any fields and properties in component instances
  • Data held in DI service instances that are scoped to the circuit

Occasionally, users may experience a temporary network connection loss, after which Blazor will attempt to reconnect them to their original circuit so they can continue.

@tanviredu
tanviredu / a-basic-react-app-for-understanding-the-basic.markdown
Created September 16, 2020 11:06
A Basic React App For understanding the Basic
@tanviredu
tanviredu / app.js
Created August 18, 2020 14:11 — forked from stongo/app.js
Joi validation in a Mongoose model
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
db.on('error', function() {
return console.error.bind(console, 'connection error: ');
});
import cv2
X_train=[]
IMG_SIZE= 32
for x in train_images:
new_array = cv2.resize(x[0],(IMG_SIZE,IMG_SIZE))
X_train.append(new_array)
@tanviredu
tanviredu / iris.csv
Created August 2, 2020 17:04 — forked from netj/iris.csv
sepal.length sepal.width petal.length petal.width variety
5.1 3.5 1.4 .2 Setosa
4.9 3 1.4 .2 Setosa
4.7 3.2 1.3 .2 Setosa
4.6 3.1 1.5 .2 Setosa
5 3.6 1.4 .2 Setosa
5.4 3.9 1.7 .4 Setosa
4.6 3.4 1.4 .3 Setosa
5 3.4 1.5 .2 Setosa
4.4 2.9 1.4 .2 Setosa
## making 4 dimension
img_rows=x_train[0].shape[0]
img_cols=x_test[0].shape[1]
X_train=x_train.reshape(x_train.shape[0],img_rows,img_cols,1)
X_test=x_test.reshape(x_test.shape[0],img_rows,img_cols,1)
#### load partial images
import cv2
import os
#### this function will import the data from the folder
def load__partial_images_from_folder(folder,target):
images = []
for filename in os.listdir(folder):
img = cv2.imread(os.path.join(folder,filename),0)
ret2,th2 = cv2.threshold(img,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
if img is not None:
def Otsus_Binarization(folder,target):
images = []
i=1
for file in os.listdir(folder):
try:
img = cv2.imread(os.path.join(folder,file),cv2.IMREAD_GRAYSCALE)
ret2,th2 = cv.threshold(img,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU)
except:
pass