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 / bloom.py
Created January 18, 2017 11:24
Bloom filter on pure python
from math import log
from array import array
from struct import unpack
from hashlib import sha512
class Bits:
__slots__ = ('data',)
def __init__(self, cap):
@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
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]
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]]