Skip to content

Instantly share code, notes, and snippets.

View Refffy's full-sized avatar
🎯
Focusing

Danial Yekibayev Refffy

🎯
Focusing
  • Almaty, Kazakhstan
View GitHub Profile
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))
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
from fastapi import APIRouter, FastAPI, File, UploadFile
import databases
from schema import PostSchema
from posts import Post
import shutil
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
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
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)
@Refffy
Refffy / Cipher.cs
Last active February 8, 2020 11:07
c# project md5 sha512
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;
@Refffy
Refffy / app.vue
Last active October 25, 2019 11:46
prostocode
<<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>