This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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): | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| # requirements: | |
| # requests | |
| # beautifulsoup4 | |
| # flask | |
| # html5lib | |
| import re | |
| import webbrowser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import log | |
| from array import array | |
| from struct import unpack | |
| from hashlib import sha512 | |
| class Bits: | |
| __slots__ = ('data',) | |
| def __init__(self, cap): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import argparse | |
| import csv | |
| import os | |
| import re | |
| import subprocess | |
| import sys | |
| from collections import OrderedDict, namedtuple | |
| from datetime import datetime, timedelta |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from heapq import heappush | |
| from functools import total_ordering, reduce | |
| def ip(s): | |
| return reduce(lambda r, c: c + (r << 8), map(int, s.split(".")), 0) | |
| @total_ordering | |
| class Subnet: | |
| def __init__(self, start, end): | |
| self.start = start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.7-alpine | |
| EXPOSE 8000 | |
| WORKDIR /app | |
| COPY . . | |
| RUN apk add --update --no-cache --virtual .build-deps \ | |
| g++ \ | |
| python-dev \ | |
| libxml2 \ | |
| libxml2-dev && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:9-alpine AS admin-build | |
| WORKDIR /app | |
| COPY manager . | |
| RUN npm install && npm run build | |
| FROM python:3.7-alpine3.7 | |
| EXPOSE 5000 | |
| WORKDIR /app |
OlderNewer