Skip to content

Instantly share code, notes, and snippets.

@onionka
onionka / overloadable.py
Created July 24, 2017 15:59
Implementation of instance function overloading achieved with annotations and inspect
import inspect
class Overloadable(object):
def __init__(self, fn):
self.base = fn
self.overloads = (fn, inspect.signature(fn).parameters),
self.instance = None
def overload(self, fn):
@onionka
onionka / calculator.py
Last active November 10, 2017 14:53
Newton-Raphson Equation Root Finder
from abc import abstractmethod, ABC
from typing import Tuple, List, Generator
class Function(ABC):
"""Function for Newton-Raphson algorithm
"""
@abstractmethod
def calculate(self, x: float) -> float:
@onionka
onionka / .tmux.conf
Created November 28, 2022 11:27
TMUX v1.8+ config
# Use 256 colors instead of 16, which is tmux default, no matter on which terminal it is running
set -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',screen-256color:RGB'
# Vi keys to control copy mode
set-window-option -g mode-keys vi
# Reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf