Skip to content

Instantly share code, notes, and snippets.

View dot1mav's full-sized avatar
🌎
D00r the Plan3t

Ma V dot1mav

🌎
D00r the Plan3t
  • echo "iran" &> /dev/null
  • 18:00 (UTC +03:30)
View GitHub Profile
@dot1mav
dot1mav / graph.txt
Created May 29, 2023 17:54
network flow
25
1 0 2 20 3 20 4 20 5 20 6 20
2 1 7 10 8 8
3 1 7 6 8 5 9 4
4 1 8 5 9 6 10 10
5 1 9 10 10 4 11 10
6 1 10 10 11 10
7 1 13 15
8 1 12 15 14 15
9 1 13 15 15 15
from random import choice
from time import time
N = int(input("N > "))
class COLORS:
GREEN = '\033[92m'
RED = '\033[91m'
ENDC = '\033[0m'
@dot1mav
dot1mav / proxy_model.py
Last active January 2, 2023 12:47
proxy object for models when you have model file in each blueprints in flask app
from flask import Flask, Blueprint
from flask_sqlalchemy.model import DefaultMeta as Model
from typing import Dict, Optional, Union
# custom type
APPLICATION = Union[Flask, Blueprint]
class ProxyModel:
app: APPLICATION
module_name: str
@dot1mav
dot1mav / auto_bp.py
Last active January 2, 2023 12:48
import blueprints auto for flask app
import os
from importlib import import_module
from flask import Flask, Blueprint
from typing import Optional, Union
# custom type
APPLICATION = Union[Flask, Blueprint]
class AutoBlueprint:
@dot1mav
dot1mav / variable.py
Created August 29, 2022 17:06
use sync variable in threading
from threading import Lock, Event
from functools import wraps
from copy import deepcopy
from typing import Callable, Optional, List, Any
class Variable:
_data: Any
_lock: Lock
_events: List[Event]
@dot1mav
dot1mav / threads.py
Created August 29, 2022 17:05
custom thread for python
from abc import ABC, abstractmethod
from threading import Event, Thread, ThreadError
from copy import deepcopy
from typing import Callable, Optional, Any, Iterable, Dict
class BaseThread(ABC):
_target: Callable[[Any], Any]
_args: Iterable[Any]
_name: str
@dot1mav
dot1mav / array.py
Created August 29, 2022 16:57
array in python
from dataclasses import dataclass, field
from typing import Any, Union, TypeVar, Literal, Tuple, List
T = TypeVar("T")
null = TypeVar("null", None, Literal["null", "Null", "NULL"])
def size_check(_size: int, _id: int) -> None:
if not isinstance(_id, int):
raise TypeError("index type of array should be int")
@dot1mav
dot1mav / std.md
Created March 30, 2022 18:44 — forked from turbo/std.md
Git Commit Message Standard

Merged from https://github.com/joelparkerhenderson/git_commit_message and https://chris.beams.io/posts/git-commit/

General Rules

  • Commit messages must have a subject line and may have body copy. These must be separated by a blank line.
  • The subject line must not exceed 50 characters
  • The subject line should be capitalized and must not end in a period
  • The subject line must be written in imperative mood (Fix, not Fixed / Fixes etc.)
  • The body copy must be wrapped at 72 columns
  • The body copy must only contain explanations as to what and why, never how. The latter belongs in documentation and implementation.
@dot1mav
dot1mav / digikala_treasure_hunt.py
Last active December 29, 2023 13:23
جمع آوری کلیه عکس های شکار گنج دیجی کالا #دیجیکالا #شکار_گنچ #شکار_گنج_دیجیکالا #treasure-hunt https://www.digikala.com/landings/treasure-hunt/
"""
write by dot1mav
req:
autopep8==1.6.0
beautifulsoup4==4.10.0
certifi==2021.10.8
charset-normalizer==2.0.8
colorama==0.4.4
commonmark==0.9.1
idna==3.3
@dot1mav
dot1mav / todo-list.py
Created January 23, 2021 16:36
simple todo list
import sqlite3
import os
from platform import system
from typing import Union
from art import tprint
from prettytable import PrettyTable