Skip to content

Instantly share code, notes, and snippets.

@EtsuNDmA
EtsuNDmA / add_python_kernel.txt
Created April 23, 2020 06:50
Using Virtual Environments in Jupyter Notebook and Python
# https://janakiev.com/blog/jupyter-virtual-envs/
# https://ipython.readthedocs.io/en/stable/install/kernel_install.html
1. Activate your venv
2. pip install --user ipykernel
3. python -m ipykernel install --user --name=myenv --display-name "Python (myenv)"
@EtsuNDmA
EtsuNDmA / .gitconfig
Last active April 7, 2021 06:42
Aliases for git commands
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold cyan)<%an>%Creset' --abbrev-commit
ss = status -s
b = branch
ca = commit -a -m
last = log -1 HEAD
co = checkout
# fuzzy checkout by ticket number for branches like feature/cool-stuff-abc1234
fco = "!f() { git branch -a | egrep -m1 \"(feature|hotfix)/.*${1}\" | sed \"s/remotes\\/origin\\///\" | xargs git checkout; }; f"
amend = commit --amend --no-edit
@EtsuNDmA
EtsuNDmA / test_respx_cheetsheet.py
Last active June 6, 2024 08:48
Небольшая шпаргалка по библиотечке respx
"""
Небольшая шпаргалка по библиотечке respx. Все это есть в документации https://lundberg.github.io/respx/guide/,
но местами написано очень коротко и не очевидно.
Зависимости: python > 3.10, httpx, respx, pytest-asyncio
"""
from typing import Any
import httpx
import pytest
# Based on https://gist.github.com/spicycode/1229612
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@EtsuNDmA
EtsuNDmA / anonymize_dicom.py
Created October 28, 2022 09:58
Simple script to anonymize dicoms in parallel
import argparse
import logging
import os
import time
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
from datetime import timedelta
from functools import partial
from pathlib import Path
import pydicom
import argparse
import logging
import os
import time
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
from datetime import timedelta
from functools import partial
from pathlib import Path
import pydicom