Skip to content

Instantly share code, notes, and snippets.

Vitaly R. Samigullin pilosus

Block or report user

Report or block pilosus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Keybase.md

Keybase proof

I hereby claim:

  • I am pilosus on github.
  • I am pilosus (https://keybase.io/pilosus) on keybase.
  • I have a public key ASB_iFYud-BE_njrIsrogstPTQGd_qt15lJ9EpyO8ATWVAo

To claim this, I am signing this object:

@pilosus
pilosus / celery_tools.md
Last active Dec 8, 2016
Tools for Distributed Computing with Celery
View celery_tools.md
View solution.md

Выполнение

Скорее всего, у меня недостаточно опыта для этого задания, поэтому решение получилось "наивным". Но лучше дать какое-то решение, чем никакого, верно?

1. Краткое описание решения

Чтобы понять, связанны ли пользователи между собой, необходимо:

@pilosus
pilosus / detect.py
Created Nov 6, 2016
A draft. You really won't like it, so don't touch!
View detect.py
#!/usr/bin/env python3
from sqlalchemy import Column, BigInteger, Integer, String, DateTime, \
UniqueConstraint, MetaData, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import forgery_py
import random
import timeit
View detect_excerpt.py
def two_ips_in_diff_24_subnets(ip1: str, ip2: str) -> bool:
"""
Return True if both given IPs are in different /24 subnets;
Return False otherwise.
>>> Is_in_diff_24_subnets('1.2.3.4', '1.2.4.5')
True
>>> is_in_diff_24_subnets('1.2.3.4', '1.2.3.5')
False
"""
@pilosus
pilosus / models.py
Created Nov 4, 2016
Comment SQLAlchemy model
View models.py
class Comment(db.Model):
"""Comment is a message under a post.
Comment that has a parent treated as a reply. Comment with replies
(children) represents n-ary tree.
"""
__tablename__ = 'comments'
id = db.Column(db.Integer, primary_key=True)
parent_id = db.Column(db.Integer, db.ForeignKey('comments.id'))
@pilosus
pilosus / AnimalTest.java
Created Oct 3, 2016
Stepic Java Basics MOOC. Step 5.4.8 unit-test
View AnimalTest.java
package org.stepic.java.module5.animalSerialization;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Created by vitaly on 03/10/16.
*/
public class AnimalTest {
@pilosus
pilosus / Animal.java
Created Oct 3, 2016
Stepic Java Basics MOOC. Step 5.4.8
View Animal.java
package org.stepic.java.module5.animalSerialization;
import java.io.Serializable;
import java.io.*;
import java.util.Objects;
/**
* Created by vitaly on 03/10/16.
*/
public class Animal implements Serializable {
@pilosus
pilosus / SerializationDemo.java
Created Oct 3, 2016
An exmple of serialization in Java
View SerializationDemo.java
package org.stepic.java.module5.serializationDemo;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDate;
/**
* Created by vitaly on 03/10/16.
@pilosus
pilosus / ParseNumsTest.java
Created Oct 3, 2016
Stepic.org Java Basics MOOC. Step 5.3.13 Streams, JUnit unit-tests for the problem
View ParseNumsTest.java
package org.stepic.java.module5.parseNums;
import java.io.*;
import org.junit.Assert;
/**
* Created by vitaly on 02/10/16.
*
* In order to have your JUnit test working, add this Java Class file into your package,
* then add JUnit 4 jar to the project's classpath:
You can’t perform that action at this time.