Skip to content

Instantly share code, notes, and snippets.

View ezyatev's full-sized avatar

Eugene Zyatev ezyatev

View GitHub Profile
@ezyatev
ezyatev / middleware.py
Last active February 10, 2020 10:51
How to limit admin login to specific IP's in Django 3?
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.urls import resolve
from netaddr import IPAddress, IPSet
def get_remote_addr(request):
return request.META['REMOTE_ADDR']
@ezyatev
ezyatev / install-dating-matcher-on-centos-with-apache.md
Last active March 13, 2019 21:59
How to Deploy Speed Friending and Dating Matcher on CentOS 7.6 with Apache server

How to Deploy Speed Friending and Dating Matcher on CentOS 7.6 with Apache server

Specially for Mikula :)

In this tutorial the domain name matcher.ml used for example. This is a free domain name from freenom.com. You can use another domain name, of course.

Tested with clean installation of CentOS.

@ezyatev
ezyatev / install-gui-xrdp-on-centos7.md
Last active September 12, 2022 01:23
Install GUI & RDP on Centos 7

Install GUI & RDP on Centos 7

Install GUI

yum groupinstall "Server with GUI"
systemctl set-default graphical.target
systemctl start graphical.target

Install xrdp

@ezyatev
ezyatev / install-comodo-ssl-cert-for-nginx.rst
Created October 10, 2018 15:55 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@ezyatev
ezyatev / linefold.c
Last active February 26, 2019 09:38
Перенос строк текста (улучшенная версия с поддержкой русского языка)
/*
* Напишите программу, печатающую символы входного потока так,
* чтобы строки текста не выходили правее n-й позиции.
* Это значит, что каждая строка, длина которой превышает n,
* должна печататься с переносом на следующие строки.
* Место переноса следует “искать” после последнего символа, отличного от символа-разделителя,
* расположенного левее n-й позиции. Позаботьтесь о том, чтобы ваша программа вела себя разумно
* в случае очень длинных строк, а также когда до n-й позиции не встречается ни одного символа пробела или табуляции.
* */