Skip to content

Instantly share code, notes, and snippets.

Maksim Koltsov tirinox

Block or report user

Report or block tirinox

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
tirinox /
Created Aug 2, 2019
My implementation of itertools.tee function
from itertools import tee
def source():
for i in range(5):
print(f'next is {i}')
yield i
import heapq
from collections import namedtuple
Task = namedtuple('Task', 'priority, id, content')
class TaskFlow:
def __init__(self):
self._queue = []
self._id = 0
tirinox / DemoMagic.ipynp
Created Jun 15, 2019
Demo of Jupyter's magic functions
View DemoMagic.ipynp
"cells": [
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# нажми здесь shift+enter, чтобы увидеть список магий\n",
View download_music.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
tirinox /
Created May 1, 2019
Make a screenshot of any webpage using Python, Selenium and Chrome
# 1) pip install selenium
# 2) ChromeDriver:
from selenium import webdriver
DRIVER = 'chromedriver'
driver = webdriver.Chrome(DRIVER)
driver.get('') # какой сайт
import hashlib
import ecdsa
import os
from binascii import hexlify
from base58 import b58encode
# Installation:
# pip install base58 ecdsa
# Use that service to make sure that this generator works well:
import socket
import select
from urllib.parse import urlsplit
def brutal_download(url, save_to):
url_components = urlsplit(url)
host = url_components.netloc
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, 80))
import operator
class Item:
def __init__(self, name, price, qty): = name
self.price = price
self.qty = qty
def total_cost(self):
# это пример показывает применение __matmul__ и __imatmul__ для пользовательских классов
class MyMatrix:
def __init__(self, data): = data
# для получения элементов матрицы как A[строка, столбец]
def __getitem__(self, pos):
i, j = pos
# this is Radix sort prove of O(n) time complexity
import random
import matplotlib.pyplot as plt
import time
def radix_sort(a_list, radix=10):
max_length_achieved = False
tmp, placement = -1, 1
You can’t perform that action at this time.