Skip to content

Instantly share code, notes, and snippets.

View naimurhasan's full-sized avatar
🏠
Working from home

Naimur Hasan naimurhasan

🏠
Working from home
View GitHub Profile
//UVa p12289 - One Two Three
//Created by @naimurhasan
#include <bits/stdc++.h>
using namespace std;
#include<iostream>
#include<queue>
using namespace std;
typedef struct Digit{
#include <bits/stdc++.h>
using namespace std;
#define RC 5
#define CC 2
void displayNum(int[RC][CC], int, bool);
/*
Sample Output
size 3
@naimurhasan
naimurhasan / getMaxMatchedIds.py
Created October 21, 2022 12:34
search through each words in db and get ids, then in script sort the id by max matching word.
def getMaxMatchedIds(rmc, words, md):
matched_ids = []
matched_id_words = {}
for word in words:
for id in md[word]:
match_count = 1
match_words = [word]
if id not in matched_ids:
for key in set(md) - set([word]):
if id in md[key]:
@register.filter()
def to_bengali(value):
string_value = str(value)
bn_digits = {
0: '০',
1: '১',
2: '২',
3: '৩',
4: '৪',
5: '৫',
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
enum RetryResponseStatus {authFailed, success, unknownError, serverError}
class MRetryResponse{
final http.Response response;
final RetryResponseStatus status;
ShaderMask(
blendMode: BlendMode.srcIn,
shaderCallback: (bounds) => LinearGradient(colors: [
curveAppBarColor,
Colors.green.shade900,
]).createShader(
Rect.fromLTWH(0, 0, bounds.width, bounds.height),
),
child: Text(String.fromCharCode(Icons.info.codePoint,), style: TextStyle(
fontFamily: Icons.add.fontFamily, fontSize: 30),
def git_pull(request):
if request.GET.get('pass') != custom_key.pull_pass:
return HttpResponse("Wrong Password")
os.system('git checkout master')
os.system('git pull origin master')
with open('requirements.txt', 'r+') as f:
text = f.read()
text = text.replace('pkg_resources==0.0.0', '')
f.seek(0)
@naimurhasan
naimurhasan / commit _file_to_git.py
Created October 12, 2021 10:01
Using pygithub upload file | Advantage do not need to clone the repo.
import base64
from github import Github
from github import InputGitTreeElement
g = Github("YOUR TOKEN")
# for org repo
# org = g.get_organization("NaimurDev")
# repo = org.get_repo('test_file')
@naimurhasan
naimurhasan / fetch_pagination_content.dart
Last active October 2, 2021 07:59
dart to get fetch pagination content from django backend with 'next'
Future<void> updateIfHasUpdate() async {
final String dataFirstFetchUri = "https://sample.django.backend.api/"
final List updatableQuestions = await _getUpdatableQuestions(dataFirstFetchUri);
}
Future<List<dynamic>> _getUpdatableQuestions(nextUri) async{
// THIS FUNCTIONS LOOP THROUGH PAGINATION
// AND RETURN data results concat
List updatableQuestions = [];
@naimurhasan
naimurhasan / smtp_mail_sender.py
Created September 29, 2021 13:41
smtp email send with mail.py
import smtplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
import key
port = 587 # For starttls
smtp_server = "send.one.com"
sender_email = "snder@senderserver.com"
receiver_email = "reciver@gmail.com"