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
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",
"%lsmagic"
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
tirinox / web_screenshot.py
Created May 1, 2019
Make a screenshot of any webpage using Python, Selenium and Chrome
View web_screenshot.py
# 1) pip install selenium
# 2) ChromeDriver: http://chromedriver.chromium.org/downloads
from selenium import webdriver
DRIVER = 'chromedriver'
driver = webdriver.Chrome(DRIVER)
driver.get('https://erugame.ru/') # какой сайт
driver.save_screenshot("screenshot.png")
View btc_generate_address.py
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:
View brutal_download.py
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))
View sort_operator.py
import operator
class Item:
def __init__(self, name, price, qty):
self.name = name
self.price = price
self.qty = qty
def total_cost(self):
View matmul_demo.py
# это пример показывает применение __matmul__ и __imatmul__ для пользовательских классов
class MyMatrix:
def __init__(self, data):
self.data = data
# для получения элементов матрицы как A[строка, столбец]
def __getitem__(self, pos):
i, j = pos
return self.data[i][j]
View radix_on.py
# 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
View christmas_tree.py
import random
class ASCIICanvas:
def __init__(self, w=50, h=100):
assert 0 < w < 1000 and 0 < h < 1000
self.w = w
self.h = h
self.buffer = []
self.clear()
View xo_flask_comments.py
import random
from flask import Flask, request
class Game:
X = 'X'
O = 'O'
N = ' '
def __init__(self, size=3, to_win=3):
You can’t perform that action at this time.