Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Maksim Koltsov tirinox

🎯
Focusing
View GitHub Profile
@tirinox
tirinox / README.md
Created Jun 23, 2021
Installation xchainpy on MacOS (M1 tested)
View README.md

Installation of xchainpy on MacOS

  1. Install libsecp256k1 via Homebrew. If you don't have Homebrew then follow the installation instructions on their website.

brew install libsecp256k1

  1. Install wheel (reminder: you do all pip-things under your Python environment):

pip install wheel

View class-decorator.py
import functools
import time
import types
class TimeItCritical:
DEFAULT_CRITICAL_TIME = 0.5
def __new__(cls, obj=None, *, critical_time=DEFAULT_CRITICAL_TIME):
"""
View named_tuple_size.py
from collections import namedtuple
from pympler.asizeof import asizeof
class PointSimple:
def __init__(self, x, y):
self.x = x
self.y = y
@tirinox
tirinox / tree2021rt.py
Created Dec 31, 2020
New Year 2021 PyWay demo
View tree2021rt.py
# inspired by https://www.shadertoy.com/view/4st3DH
import array
import os
from math import *
import colorsys
W, H = 640, 480
OUT_FILE = 'test_2.ppm'
View 3dwalk-curses-win-bw.py
# ЧБ версия для Windows, установи библиотеку:
# pip install windows-curses
import curses
import locale
from math import pi, cos, sin
POS_X, POS_Y, POS_A = 2, 2, 0 # Положение и поворот игрока на карте (начальные)
FOV = pi / 2 # Ширина угла обзор в радинах
RESOLUTION = 0.1 # разрешение шага луча
DEPTH = 16 # Максимальная глубина прорисовки
View closure_fix.py
@classmethod
def register(cls, cfg: Config, db: DB, dp: Dispatcher, loc_man: LocalizationManager, **kwargs):
members = cls.__dict__.items()
for name, f in members:
if not hasattr(f, 'handler_stuff'):
continue
handler_stuff = f.handler_stuff
@dp.message_handler(*handler_stuff['custom_filters'],
commands=handler_stuff['commands'],
@tirinox
tirinox / MaxFeeTxHandler.java
Created Oct 24, 2020
This is a solution of week 1 for the Bitcoin and Cryptocurrency Technologies course (scrooge coin)
View MaxFeeTxHandler.java
/**
* This is a solution of week 1 for the Bitcoin and Cryptocurrency Technologies course (scrooge coin)
* https://www.coursera.org/learn/cryptocurrency
* Please, try yourself before looking this code
* I was able to get 100/100 score!
*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@tirinox
tirinox / mandel_animation.py
Created Apr 29, 2020
Dive into Mandelbrot fractal (GIF, Python)
View mandel_animation.py
from PIL import Image
from tqdm import tqdm
import math
W, H = 200, 200 # размеры картинки
ITER = 255
FRAMES = 100
@tirinox
tirinox / bf.py
Last active Apr 2, 2020
Python brainfuck interpreter
View bf.py
import sys
def run(code, mem_size=256):
# 1. этап составим карту скобок
# ключ и значения - индекс байта в коде
# по любой скобке находим ей пару
bracket_map = {}
stack = []
for pos, symbol in enumerate(code):
@tirinox
tirinox / corona.csv
Last active Apr 15, 2020
Предсказание числа заболевших коронавирусом из Китая
View corona.csv
day infected dead
20.01.2020 278 4
21.01.2020 326 6
22.01.2020 547 8
23.01.2020 639 14
24.01.2020 916 25
25.01.2020 2000 40
26.01.2020 2700 57
27.01.2020 4400 64
28.01.2020 5970 87