Skip to content

Instantly share code, notes, and snippets.

View vlee-harmonicinc's full-sized avatar

vlee-harmonicinc vlee-harmonicinc

View GitHub Profile
@vlee-harmonicinc
vlee-harmonicinc / docker_save_export_commit.md
Last active December 28, 2022 13:42
docker: save vs export vs commit
input output corresponding cmd
save image image tar load -> image
export container container tar import -> image
commit container image run -> container
@vlee-harmonicinc
vlee-harmonicinc / python_log.py
Created August 3, 2020 08:21
Usually, I write INFO log to file and warn to stdout. Since those option is exclusive in basicConfig function, need to create two handler separately.
def setup_logger(log_file):
log_format = '[%(asctime)s][%(process)5d][%(levelname)s][%(filename)s L%(lineno)d]%(message)s'
# write to file
file_handler = logging.FileHandler(log_file, 'w')
file_handler.setLevel(logging.INFO)
# stream to stdout
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setLevel(logging.WARN)
stdout_handler.setFormatter(logging.Formatter(fmt=log_format))
logging.basicConfig(level=logging.INFO, format=log_format, handlers=[file_handler, stdout_handler])
@vlee-harmonicinc
vlee-harmonicinc / python_virtual_env.md
Last active July 15, 2020 02:29
Python virtual environment tools

Python virtual Env

virtualenv

lightweight(poor man) isolation via modifying PATH to prefix it with custom bin docs

pip3 install virtualenv # isntall virtualenv
cd <repo>
virtualenv <venv> # create new environment <venv>
source venv/bin/activate # enter virtual env
pip install -r requirements.txt # install all python modules
@vlee-harmonicinc
vlee-harmonicinc / plugins.md
Last active July 7, 2020 10:06
useful plugins for CS researchers

arXiv pdf pages do not show title. It could be messy when opening multiple tabs for arXiv papers. I always open multiple page, when reading references from one paper or comparing different algorithm. With this plugin, the paper titles are shown and it is easier to distinguish

Github Markdown do not show LaTeX :( This also works for inline LaTeX $ $ in my readthedocs note. For multi-line LaTex, it is a bit bugy. ```math ``` is not supported by this plugin, but recommonmark require Math codeblock.

Add link to code