Edit: This list is now maintained in the rust-anthology repo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ambra_sdk.api import Api | |
# Init api | |
api = Api.with_creds( | |
url=url, | |
username=username, | |
password=password, | |
client_name=my_client_name, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = "." | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |