Skip to content

Instantly share code, notes, and snippets.

View chinskiy's full-sized avatar
🇺🇦

Dmytro Vdovychynskyi chinskiy

🇺🇦
View GitHub Profile
@chinskiy
chinskiy / ranges.txt
Created March 15, 2022 17:24
List of ASN and IP ranges that belongs to the main providers of Luhansk People's Republic(LPR) and Donetsk People's Republic(DPR)
# List of ASN and IP ranges that belongs to the main providers of so-called Luhansk People's Republic(LPR) and Donetsk People's Republic(DPR)
# Data taken from wiki articles
# https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D1%82%D0%B5%D1%80%D0%BD%D0%B5%D1%82_%D0%B2_%D0%9B%D1%83%D0%B3%D0%B0%D0%BD%D1%81%D0%BA%D0%BE%D0%B9_%D0%9D%D0%B0%D1%80%D0%BE%D0%B4%D0%BD%D0%BE%D0%B9_%D0%A0%D0%B5%D1%81%D0%BF%D1%83%D0%B1%D0%BB%D0%B8%D0%BA%D0%B5
# https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D1%82%D0%B5%D1%80%D0%BD%D0%B5%D1%82_%D0%B2_%D0%94%D0%BE%D0%BD%D0%B5%D1%86%D0%BA%D0%BE%D0%B9_%D0%9D%D0%B0%D1%80%D0%BE%D0%B4%D0%BD%D0%BE%D0%B9_%D0%A0%D0%B5%D1%81%D0%BF%D1%83%D0%B1%D0%BB%D0%B8%D0%BA%D0%B5
ASN list:
AS43201 https://lugacom.com/
AS208890 https://rck.su/
AS39728 https://luganet.ru/
AS204108 http://phoenix-dnr.ru/
def get_flag_value(flag_name, uid, pct=50):
random = Random()
if six.PY2:
random.seed("%s-%s" % (uid, flag_name))
else:
random.seed("%s-%s" % (uid, flag_name), version=1)
return int(random.random() * 100) + 1 <= pct
# Python 2.7.16
In [1]: import random
...: random.seed('some_seed')
...: random.random()
Out[1]: 0.4439539753657198
# Python 3.7.3
In [1]: import random
...: random.seed('some_seed', version=1)
...: random.random()
# Python 2.7.16
In [1]: import random
...: random.seed('some_seed')
...: random.randint(1, 100)
Out[1]: 45
# Python 3.7.3
In [1]: import random
...: random.seed('some_seed', version=1)
...: random.randint(1, 100)
def get_flag_value(flag_name, uid, pct=50):
random = Random()
if six.PY2:
random.seed("%s-%s" % (uid, flag_name))
else:
random.seed("%s-%s" % (uid, flag_name), version=1)
return int(random.random() * 100) + 1 <= pct
def get_flag_value(flag_name, uid, pct=50):
random = Random()
random.seed("%s-%s" % (uid, flag_name), version=1)
return int(random.random() * 100) + 1 <= pct
def get_flag_value(flag_name, uid, pct=50):
random = Random()
random.seed("%s-%s" % (uid, flag_name))
return random.randint(1, 100) <= pct
@chinskiy
chinskiy / .pep8speaks.yml
Created May 18, 2017 21:00
my pep8speaks.yml conf file
message: # Customize the comment made by the bot
opened: # Messages when a new PR is submitted
header: "Hi! Thank you for submitting the Pull Request !"
# The keyword {name} is converted into the author's username
footer: "Do see the [Hitchhiker's guide to code style](https://goo.gl/hqbW4r)"
# The messages can be written as they would over GitHub
updated: # Messages when new commits are added to the PR
header: "Hi! Thank you for updating !"
footer: ""
import pika
import json
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='creation', durable=True)
message = {'id': '111',
'message': 'hallo_world'}