Skip to content

Instantly share code, notes, and snippets.

View liviaerxin's full-sized avatar

Frank liviaerxin

  • ASTRI
  • Hong Kong
View GitHub Profile
@liviaerxin
liviaerxin / README.md
Last active May 2, 2024 00:04
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
@lostintangent
lostintangent / 1 - Intro---README.md
Last active December 7, 2023 12:55
Learning MobX (Side-Effects)

1: Intro

Welcome to the interactive tutorial on how to use side-effect "operators" in MobX! Over the course of the next three samples, you'll learn (and be able to explore) exactly how autorun, when and reaction work, and when/why you would use them when building reactive applications.

@alexeygrigorev
alexeygrigorev / create_python_files.sh
Last active August 16, 2022 15:34
tf.make_tensor_proto
pip install grpcio-tools
wget https://github.com/tensorflow/tensorflow/archive/v1.9.0.zip -O tf-190.zip
unzip tf-190.zip && rm tf-190.zip
wget https://github.com/tensorflow/serving/archive/1.9.0.zip -O tf-serving-190.zip
unzip tf-serving-190.zip && rm tf-serving-190.zip
mv serving-1.9.0/tensorflow_serving tensorflow-1.9.0
@bgauduch
bgauduch / multiple-repository-and-identities-git-configuration.md
Last active May 5, 2024 19:38
Git config with multiple identities and multiple repositories

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
#!/usr/bin/python3
#-*- coding: utf-8 -*-
import logging
import timeit
import traceback
import time
import gi
gi.require_version('Gst', '1.0')
@garcia556
garcia556 / get.c
Created December 3, 2017 21:08
POSIX shared memory IPC example (shm_open, mmap), working on Linux and macOS
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define STORAGE_ID "/SHM_TEST"
#define STORAGE_SIZE 32
int main(int argc, char *argv[])
@philipstanislaus
philipstanislaus / sane-caching.nginx.conf
Last active April 11, 2024 03:35
Sample Nginx config with sane caching settings for modern web development
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@idelsink
idelsink / .clang-format
Created March 7, 2016 22:03
Clang format file.
# clang-format
# Made by: Ingmar Delsink
# idelsink.com
# See http://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Tested with: clang-format version 3.7.1
# General
#########
# The style used for all options not specifically set in the configuration.