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
@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')
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)
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),
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;
@register.filter()
def to_bengali(value):
string_value = str(value)
bn_digits = {
0: '০',
1: '১',
2: '২',
3: '৩',
4: '৪',
5: '৫',
@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]:
#include <bits/stdc++.h>
using namespace std;
#define RC 5
#define CC 2
void displayNum(int[RC][CC], int, bool);
/*
Sample Output
size 3
//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{