Skip to content

Instantly share code, notes, and snippets.

@liviaerxin
liviaerxin / README.md
Last active January 17, 2026 14:46
FastAPI and Uvicorn Logging #python #fastapi #uvicorn #logging

FastAPI and Uvicorn Logging

When running FastAPI app, all the logs in console are from Uvicorn and they do not have timestamp and other useful information. As Uvicorn applies python logging module, we can override Uvicorn logging formatter by applying a new logging configuration.

Meanwhile, it's able to unify the your endpoints logging with the Uvicorn logging by configuring all of them in the config file log_conf.yaml.

Before overriding:

uvicorn main:app --reload
@liviaerxin
liviaerxin / deep_learning_deployment.md
Last active November 12, 2025 19:26
Deep Learning Deployment #deep-learning

Deep Learning Deployment

Top Deep Learning Server

| Framework | Supported Models | GPU Libraries | | TensorFlow Serving | TensorFlow | cuDNN | | OpenVINO Model Server | TensorFlow, Caffe, ONNX, MXNet | clDNN | | Trtion Inference Server | TensorFlow, TensorRT, ONNX, Caffe2, PyTorch | cuDNN |

@liviaerxin
liviaerxin / Dicom3dCube.py
Last active September 22, 2025 07:27
DICOM Files Read, 3D Reconstruction and Visualization. #vtk-dicom
"""
DICOM files --> vtk array --> vtk 3D visualization
1. read a series of DICOM files by vtkDICOMImageReader(which will do HU and don't resample)
2. process vtk 3D array with marching cubes algorithm
3. render vtk 3D array
"""
import vtk
from utils import CreateTissue
@liviaerxin
liviaerxin / gstreamer_empty_plugin_test_case.py
Last active July 8, 2025 02:07
Install Gst Python Binding
#!/usr/bin/python3
#-*- coding: utf-8 -*-
import logging
import timeit
import traceback
import time
import gi
gi.require_version('Gst', '1.0')
@liviaerxin
liviaerxin / build_opencv_in_mac.md
Last active May 24, 2025 23:43
Build OpenCV and Python Bindings in Mac(QT, Gstreamer Support)

Build OpenCV in Mac with QT, Gstreamer Support

Install dependencies

brew install cmake #
brew install qt5 #optional
brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav #optional
pip3 install numpy
@liviaerxin
liviaerxin / ffmpeg_samples.md
Last active September 3, 2024 17:09
FFmpeg samples #ffmpeg

FFmpeg Samples

FFmpeg Wiki

List private options of the codec

# Show available `presets`
ffmpeg -h encoder=h264_nvenc
@liviaerxin
liviaerxin / simple_vpn_server_setting.md
Last active September 2, 2024 11:47
Simple VPN Server #vpn

VPN Server Setting

ocserv

# 
docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -d tommylau/ocserv
# set username/password
docker exec -it ocserv ocpasswd -c /etc/ocserv/ocpasswd -g "Route,All" frank
# delete user