This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import sample, randint | |
from colr import color | |
# From itertools recipes | |
def random_permutation(iterable, r=None): | |
pool = tuple(iterable) | |
r = len(pool) if r is None else r | |
yield tuple(sample(pool, r)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint, getrandbits | |
from typing import Dict, List, Tuple | |
from datetime import datetime | |
def is_leap(year: int) -> bool: | |
return False if year % 4 != 0 else( | |
True if year % 100 != 0 | |
else( | |
True if year % 400 == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import APIRouter, FastAPI, File, UploadFile | |
import databases | |
from schema import PostSchema | |
from posts import Post | |
import shutil | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydantic import BaseModel | |
from dataclasses import field | |
from datetime import datetime | |
from typing import List | |
class PostSchema(BaseModel): | |
id: int = None | |
url: str | |
usr_name: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy_utils import URLType | |
from sqlalchemy.orm import mapper | |
from sqlalchemy import MetaData | |
from sqlalchemy import DateTime | |
from sqlalchemy import Integer | |
from sqlalchemy import Column | |
from sqlalchemy import String | |
from sqlalchemy import Table | |
from sqlalchemy import ARRAY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from sys import argv | |
def pixelate(inpt, outpt, colors, k): | |
img = Image.open(inpt).convert('P', palette=Image.ADAPTIVE, colors=colors) | |
w, h = img.size | |
img = img.resize((285, 385)).resize((w, h), Image.NEAREST) | |
img.quantize(colors=colors, kmeans=k) | |
img.save(outpt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
using System.Security.Cryptography; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<<template> | |
<div id="app"> | |
<div id="search"> | |
<input v-model="searchTmp" placeholder="Поиск по ФИО преподавателя" /> | |
<small>{{ list.length }} результатов</small> | |
</div> | |
<div id="list"> | |
<div class="item" v-for="(item, i) in list" :key="i"> | |
<div> | |
<h3>{{ item.type }}</h3> |