Skip to content

Instantly share code, notes, and snippets.

View rodion-solovev-7's full-sized avatar

Родион Соловьев rodion-solovev-7

  • bank24
  • Ekaterinburg
View GitHub Profile
@rodion-solovev-7
rodion-solovev-7 / dnSpy_wine32.md
Created December 28, 2023 20:27
How to run dnSpy on linux (using wine)

How to run dnSpy on linux (using wine)

  1. Using PlayOnLinux seems simplest solution.
  2. Install WINE 5.11 (distributions with later versions work worse or run the program).
  3. Install Mono (not dotnet framework) in WINE prefix.
  4. Download dnSpy 32-bit executable (64-bit version of the program breaks down much more often)ю
  5. Copy dnSpy into wine prefix & run it.
  6. On my setup (amd64 processor, ubuntu 20.04), this is the only solution that worked correctly and stably.
@rodion-solovev-7
rodion-solovev-7 / cache_result_by_args.py
Created September 22, 2023 22:38
Try to write own async-sync ttl cache decorator (danger: shitcode)
import asyncio
import functools
import time
def cached_by_args(sync_or_async_func):
expiration_offset = 1.5
cache = {}
def is_cache_actual(args, kwargs, now) -> bool:
@rodion-solovev-7
rodion-solovev-7 / example.py
Created January 3, 2023 16:08
Упоротый способ внедрять fastapi.Depends туда, где он не нужен
from fastapi import Depends
from fastapi_depends import inject_dependencies
def get_my_dep1() -> str:
# any type obj may be here. sqlalchemy.session and etc
yield 'HELLO WORLD'
@inject_dependencies()
@rodion-solovev-7
rodion-solovev-7 / prepare_spelling_dict.sh
Created June 21, 2022 21:58
Spelling dictionaris for IDE (ru).sh
mkdir -p ~/.ide-spelling/
curl https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/Russian.aff >> .ide-spelling/Russian.aff
curl https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/Russian.dic >> .ide-spelling/Russian.dic
# TODO: add directly into PyCharm config
@rodion-solovev-7
rodion-solovev-7 / move_window_to_workspace_and_switch_it.sh
Created May 22, 2022 09:50
Sends the window to the right workspace + switches to this workspace. Useful as a shortcut script if your Linux does not support this shortcut
win_id="$(xdotool getactivewindow)";
desk_id="$(xdotool get_desktop)";
desk_id=$((desk_id + 1));
xdotool set_desktop_for_window "$win_id" "$desk_id";
xdotool set_desktop "$desk_id";
@rodion-solovev-7
rodion-solovev-7 / queries.sql
Last active March 31, 2022 14:46
Generate SQL for DB creation (SQLAlchemy)
CREATE TABLE my_table (
id SERIAL NOT NULL,
my_data VARCHAR,
PRIMARY KEY (id)
);
@rodion-solovev-7
rodion-solovev-7 / drinkin_game.py
Created February 15, 2022 12:48
Drinkin' game (Lena's Adventures)
# Дата: где-то около октября 2020
#
# Написано за час на паре как доказательство того, что классы существуют.
# (Да-да, они и вправду существуют!)
# Правок и изменений архитектуры не планируется.
from random import randint
class Alcohol:
@rodion-solovev-7
rodion-solovev-7 / GenericDAL_example.ipynb
Created February 10, 2022 09:41
(Не)адекватное использование Generic в python-коде: получение T-класса и пример нафига это может понадобиться
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rodion-solovev-7
rodion-solovev-7 / decorator_with_keep_signature.py
Last active February 2, 2022 17:22
Декоратор, подменяющий код, но сохраняющий сигнатуру функции
import functools
import inspect
from typing import TypeVar, Callable
RetT = TypeVar("RetT")
def replace_code_and_keep_signature(func: Callable[..., RetT]) -> Callable[..., RetT]:
"""Декоратор, который создаёт функцию с эквивалентной сигнатурой, но другим кодом.
@rodion-solovev-7
rodion-solovev-7 / 2021.10.22_log_comparing.ipynb
Last active October 23, 2021 08:56
Сами файлы логов не залились [:-|]. С учётом поправок, записей, отсутствующих в pin_log.txt, но присутствующих в pintset_finish.log - нет. out2.txt - записи из pintset_finish.log, которых нет в pin_log.txt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.