Skip to content

Instantly share code, notes, and snippets.

View discrimy's full-sized avatar

Alexander Bespalov discrimy

View GitHub Profile
char_to_dig = {
'0': 0,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
from typing import Set
# Библиотека pyyaml (https://pyyaml.org/wiki/PyYAMLDocumentation)
import yaml
class IllegalServicesDependenciesError(RuntimeError):
pass
@discrimy
discrimy / main.py
Created December 15, 2019 15:09
pydi example Random person generator
from flask import Flask, jsonify
from pydi.context import BeanContext
from services import *
if __name__ == '__main__':
ctx = BeanContext()
ctx.scan(globals())
ctx.init()
@discrimy
discrimy / views.py
Created April 11, 2021 17:54
Generic Django view factory based on required HTTP method
from typing import Optional, Any, Callable
from django.http import HttpRequest, HttpResponse, HttpResponseNotAllowed
View = Callable[..., HttpResponse]
def view_dispatch(
*,
@discrimy
discrimy / preinstall-vscode-extensions.sh
Created August 1, 2023 21:26
Script to preinstall vscode extensions inside devcontainer image
#!/bin/env bash
set -e
# USAGE:
# COPY .devcontainer/ /app/.devcontainer/
# ARG VSCODE_VERSION=2ccd690cbff1569e4a83d7c43d45101f817401dc
# RUN bash .devcontainer/preinstall-vscode-extensions.sh $VSCODE_VERSION /app/.devcontainer/devcontainer.json
#
# Preinstall vscode server extensions.
# Uses vscode of provided version (git commit hash) to download extensions inside container