Skip to content

Instantly share code, notes, and snippets.

View Zzl615's full-sized avatar

Noaghzil Zzl615

View GitHub Profile

问题描述

在golang里,如何规范context类型key的使用

Q1: "should not use built-in type string as key for value; define your own type to avoid collisions"

A!: 现代软件都是团队开发的,多人协作的成果。

一个ctx对象在整个生命周期中,可能经过多个模块使用,每一个模块都可能使用 ctx 来存储相应信息。

@Zzl615
Zzl615 / httpx_aiohttp.py
Created November 20, 2022 23:15 — forked from imbolc/httpx_aiohttp.py
Httpx vs aiohttp benchmark
from starlette.applications import Starlette
from starlette.routing import Route
from starlette.responses import PlainTextResponse
import httpx
import aiohttp
HOST, PORT = "localhost", 8000
URL = f"http://{HOST}:{PORT}/"
@Zzl615
Zzl615 / delete_git_submodule.md
Created May 23, 2022 06:05 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@Zzl615
Zzl615 / nginx.conf
Created March 19, 2021 17:03 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
alias gpl="git pull origin"
alias gps="git push origin"
alias gst="git status"
alias gd="git diff"
alias gsm="git commit -m"
alias grs="git reset --soft"
alias grh="git reset --hard"
alias gdca='git diff --cached'
alias del_pyc="find . -type f -name '*.pyc' -delete"
alias py_info="python --version"