Skip to content

Instantly share code, notes, and snippets.

View vcancy's full-sized avatar

Vcancy vcancy

View GitHub Profile
@vcancy
vcancy / fastapi_cbv.py
Created March 1, 2020 08:34 — forked from dmontagu/fastapi_cbv.py
FastAPI CBV
import inspect
from typing import Any, Callable, List, Type, TypeVar, Union, get_type_hints
from fastapi import APIRouter, Depends
from pydantic.typing import is_classvar
from starlette.routing import Route, WebSocketRoute
T = TypeVar("T")
CBV_CLASS_KEY = "__cbv_class__"
# -*- coding: utf-8 -*-
# Print iterations progress
def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional : prefix string (Str)
@vcancy
vcancy / Dockerfile
Created June 8, 2018 01:52 — forked from magno32/Dockerfile
Dockerfile that creates a build environment for Metabase
FROM ubuntu:xenial
ENV DEBIAN_FRONTEND noninteractive
#Install git and java
RUN apt-get update && \
apt-get -y install locales && \
apt-get -y install \
software-properties-common \
sudo \
DELIMITER //
CREATE FUNCTION STRINGDECODE(str TEXT CHARSET utf8)
RETURNS text CHARSET utf8 DETERMINISTIC
BEGIN
declare pos int;
declare escape char(6) charset utf8;
declare unescape char(3) charset utf8;
set pos = locate('\\u', str);
while pos > 0 do