Skip to content

Instantly share code, notes, and snippets.

View dyens's full-sized avatar
😾

Alexander Kapustin dyens

😾
View GitHub Profile
@dyens
dyens / deps-hell.png
Last active February 4, 2024 15:45
Python projects
deps-hell.png
#!/bin/bash
#
# Adjusted for CentOS7/RHEL/Fedora
#
# Note: ideally networKManager would handle this via dnsmasq, but it doesn't
# appear to handle this dynamically as of yet. So we'll just clobber it.
# We run the risk that NeworkManager will replace it later..
#
# Parses DHCP options from openvpn to update resolv.conf
# To use set as 'up' and 'down' script in your openvpn *.conf:
@dyens
dyens / build.py
Last active March 5, 2023 19:05
Pip install poetry dev dependencies
# Code have some little changes from the origial https://github.com/python-poetry/poetry-core/blob/main/src/poetry/core/masonry/api.py
# Usage:
# 1. copy this file to /project/build.py
# 2. modify build-system section in pyproject file:
#
# [build-system]
# requires = ["poetry-core"]
# build-backend = "build"
# backend-path = "."
#
@dyens
dyens / engines.org
Created September 6, 2021 13:53
engines

UE4

Удобство

Нужна хорошая машина

Mой ноут с дискретной nvidia еле справляется. Компиляция проекта занимает (3d игра с стрельбой по кубикам) 44 минуты 258 мб собранный проект

Наверное для создания сложных 3d игр удобен

Языки

  • bluerprint
  • c++
@dyens
dyens / mock_study_time.py
Created July 29, 2021 11:29
Mock study time
from ambra_sdk.api import Api
from ambra_sdk.service.filtering import Filter, FilterCondition
from ambra_sdk.models import Account, Study
ACCOUNT_NAME = 'SOME ACCOUNT'
STUDY_TIME_TAG = '(0008,0030)'
CUSTOMFIELD_NAME = 'study_time_cf'
NEW_STUDY_TIME = '012345.000000'
@dyens
dyens / rate_limit.py
Created June 24, 2021 18:43
rate limit example
from concurrent.futures import ThreadPoolExecutor
import threading
from math import floor
from time import monotonic, sleep
import sys
from functools import wraps
def rate_limit(calls, period):
"""Rate limit decorator.
@dyens
dyens / tpl.py
Created May 1, 2021 12:19
Encrypt some fields in log messages
import logging
import logging.config
# pip install cryptography
from cryptography.fernet import Fernet
# FROM https://github.com/madzak/python-json-logger/blob/master/src/pythonjsonlogger/jsonlogger.py#L18
RESERVED_ATTRS = ('args', 'asctime', 'created', 'exc_info', 'exc_text',
'filename', 'funcName', 'levelname', 'levelno', 'lineno',
'module', 'msecs', 'message', 'msg', 'name', 'pathname',
@dyens
dyens / ambra_modalities.py
Last active March 10, 2021 09:54
Ambra. Get modalities in study
from ambra_sdk.api import Api
# Init api
api = Api.with_creds(
url=url,
username=username,
password=password,
client_name=my_client_name,
)
@dyens
dyens / ambra_multithreading_batch.py
Last active August 25, 2020 15:34
Example of mutple queries execution using ambra-sdk
"""
This is example of executing big number of queries using SDK.
Suppose we have big number of studies.
For each study we need execute Study.set query.
"""
from ambra_sdk.api import Api
api = Api.with_creds(