Skip to content

Instantly share code, notes, and snippets.

View deliro's full-sized avatar
🦀
Rust in action

deliro

🦀
Rust in action
  • Tochka Bank
  • Russia
View GitHub Profile
@deliro
deliro / gunicorn.service
Created July 19, 2016 16:36
Create systemd service
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/sammy/myproject
ExecStart=/home/sammy/myproject/myprojectenv/bin/gunicorn --workers 3 --bind unix:/home/sammy/myproject/myproject.sock myproject.wsgi:application
# coding: utf-8
# requirements:
# requests
# beautifulsoup4
# flask
# html5lib
import re
import webbrowser
class Matrix(object):
data = None
def __init__(self, data):
self.data = data
self.columns = len(self.data)
self.rows = len(self.data[0])
def get(self, t):
return self.data[t[0]][t[1]]
from django.template.defaultfilters import slugify as django_slugify
alphabet = {'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ё': 'yo', 'ж': 'zh', 'з': 'z', 'и': 'i',
'й': 'j', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't',
'у': 'u', 'ф': 'f', 'х': 'kh', 'ц': 'ts', 'ч': 'ch', 'ш': 'sh', 'щ': 'shch', 'ы': 'i', 'э': 'e', 'ю': 'yu',
'я': 'ya'}
def slugify(s):
"""
def calculate_volume(relief):
left_max = 0
right_max = 0
left = 0
right = len(relief) - 1
volume = 0
while left < right:
if relief[left] > left_max:
left_max = relief[left]