What to Do With Long Strings in YAML? YAML already defines this. In this case, there are four methods: |: Newlines under it are preserved as newlines, and the last line ends with a newline. >: Newlines under …
Links
All posts
Top 25 Nginx Tips and Tricks From Practical Experience server_tokens off; ssl_protocols TLSv1.2 TLSv1.3; Disable any undesirable HTTP methods location / { limit_except GET HEAD POST { deny all; } } Enable …
Build a Lightweight Docker Image for Your Go App? | IT Man go build # default $ go build -o test1 main.go $ du -sh test1 14M test1 # You can add `-ldflags "-s -w"` during compilation to reduce the binary size …
[Golang] Use build tags for different build configs Go build -ldflags package main import ( "fmt" ) var flagString string func main() { fmt.Println("This build with ldflag:", flagString) } $ go build -ldflags …
A Concise Go embed Tutorial Embedding For a single file, you can embed it as string or []byte For multiple files and directories, you can embed them as a new filesystem (FS) Import the “embed” package even if …
Using Vim as a Diff Tool command vim -d file1.txt file2.txt or vimdiff file1.txt file2.txt Switching Between Diff Windows: Ctrl-w + Ctrl-w Changing Split Window Orientation ctrl-w + K key combination to change …
OIDC(OpenID Connect) 简介 Authentication vs. authorization Authentication 通常是指校验是否是用户本人的这个过程,而 Authorization 则更多的是指用户是否有权限。通常我们都是先校验 是否是用户本人,然后再校验用户是否有权限。也就是先开始 Authentication,再开始 Authorization。 Authentication …
Bash Bitwise Operators Bash’s Tools for Base Conversion Bash’s arithmetic expansion allows us to write numbers in any base by prefixing the numeric digits of the base followed by the hash symbol. $ echo …
Simple A/B Testing with Nginx split_clients ngx_http_split_clients_module Configure For example, suppose we want 20% of users to be redirected to https://example.com/, 30% to https://example.org/, and the rest …
Monitoring HTTP Requests on a Network Interface in Real Time tcpflow apt/dnf install tcpflow $ sudo tcpflow -p -c -i wlp0s20f3 port 80 | grep -oE '(GET|POST) .* HTTP/1.[01]|Host: .*' reportfilename: …
Go pprof in Practice Bomb program package main import ( // omitted _ "net/http/pprof" // auto-register handlers to the HTTP server for profiling via HTTP // omitted ) func main() { // omitted …
Parse Command Line Arguments in Bash getopts getopts optstring opt [arg ...] #!/bin/bash while getopts 'abc:h' opt; do case "$opt" in a) echo "Processing option 'a'" ;; b) echo "Processing option 'b'" ;; c) …