Skip to content

Instantly share code, notes, and snippets.

Certbot и nginx, как обратный прокси в Docker (пример с 2 react проектами)

В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам

Цели

  • Запустить nginx в одном контейнере
  • Запустить другие проекты в других контейнерах
  • Научить nginx перенаправлять запросы с разных доменов на разные проекты
  • Получить ssl сертификаты для всех проектов
@mitrofun
mitrofun / urls.py
Created July 4, 2020 22:01 — forked from iMerica/urls.py
Email verification in Django Rest Framework, Django All-Auth, Django Rest-Auth. Suitable for Single Page Applications
urlpatterns = [
url(r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', ConfirmEmailView.as_view(), name='account_confirm_email'),
]
@mitrofun
mitrofun / html
Created July 2, 2020 20:13 — forked from maxdenaro/html
HTML Email Template
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>HTML Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
width: 100% !important;
Авторизация\Регистрация
https://github.com/jazzband/django-oauth-toolkit
https://github.com/pennersr/django-allauth
https://github.com/sunscrapers/djoser
https://github.com/django-guardian/django-guardian
https://github.com/flavors/django-graphql-jwt
Защита входа
https://github.com/jazzband/django-axes
https://github.com/jazzband/django-defender
@mitrofun
mitrofun / start-video-stream-w-opencv.py
Created May 31, 2020 13:38 — forked from keithweaver/start-video-stream-w-opencv.py
Stream video in Python using OpenCV
# For more info: http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_display/py_video_display.html
import cv2
import numpy as np
# Playing video from file:
# cap = cv2.VideoCapture('vtest.avi')
# Capturing video from webcam:
cap = cv2.VideoCapture(0)
currentFrame = 0
Создание пользователя
---------------------
adduser username
usermod -aG sudo username
group username
su username
---------------------------------------
Компиляции python 3.6
----------------------
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev
@mitrofun
mitrofun / .drone.yml
Created May 20, 2020 15:55 — forked from anson-vandoren/.drone.yml
Sample .drone.yml configuration file
---
################
# Build & Test #
################
kind: pipeline
name: run_tests
steps:
# Run tests against React client app (with Jest)
@mitrofun
mitrofun / cuter.py
Created March 27, 2020 13:48 — forked from sigilioso/cuter.py
Python PIL Example: get a thumbnail by resizing and cropping an image.
# -*- coding: utf-8 -*-
import Image
def resize_and_crop(img_path, modified_path, size, crop_type='top'):
"""
Resize and crop an image to fit the specified size.
args:
img_path: path for the image to resize.
@mitrofun
mitrofun / mongoengine_jsonencoder.py
Created February 19, 2020 19:53 — forked from corydolphin/mongoengine_jsonencoder.py
Fix: TypeError: ObjectId is not JSON serializable: A Flask JSONEncoder for Mongoengine documents. Specifically useful for use with Flask-Mongoengine.
from flask import Flask
from flask.json import JSONEncoder
from bson import json_util
from mongoengine.base import BaseDocument
from mongoengine.queryset.base import BaseQuerySet
class MongoEngineJSONEncoder(JSONEncoder):
def default(self,obj):
if isinstance(obj,BaseDocument):
return json_util._json_convert(obj.to_mongo())