Skip to content

Instantly share code, notes, and snippets.

View tianchaijz's full-sized avatar
🏠
Working from home

tianchaijz tianchaijz

🏠
Working from home
View GitHub Profile
View tunnel.md
  1. Gen cert
openssl req -x509 -nodes -newkey rsa:2048 -sha256 -keyout client.key -out client.crt -subj "/C=US/ST=FL/L=Ocala/O=Company/CN=x.org"
  1. tunnel.service
@tianchaijz
tianchaijz / HighTrafficServerSettings.md
Created April 6, 2022 05:05 — forked from fschiettecatte/HighTrafficServerSettings.md
High Traffic Server Settings on CentOS 8
View HighTrafficServerSettings.md

High Traffic Server Settings on CentOS 8

I recently did some work to optimize the network configuration of a CentOS 8 based web server that receives a lot of traffic.

There is a lot of information on the web for this and it distills down to a minimum recommended configuration, and a recommended configuration.

The minimum recommended configuration should be sufficient for servers with less than 10Gb, and the recommended configuration should be sufficient for servers with 10Gb or more.

@tianchaijz
tianchaijz / CGO.md
Created February 16, 2022 03:21 — forked from dwbuiten/CGO.md
View CGO.md

Problems & Solutions for Interaction Between C and Go

At Vimeo, on the transcoding team, we work a lot with Go, and a lot with C, for various tasks such as media ingest. This means we use CGO quite extensively, and consequently, have run into bits that are perhaps not very well documented, if at all. Below is my effort to document some of the problems we've run into, and how we fixed or worked around them.

Many of these are obviously wrong in retrospect, but hindsight is 20/20, and these problems do exist in many codebases currently.

Some are definitely ugly, and I much welcome better solutions! Tweet me at @daemon404 if you have any, or have your own CGO story/tips, please! I'd love to learn of them.

Table of Contents

View gist:a249339b369f07efcb7f8aa10b12e21a
当年,微软规定的编码风格是,(变量名里面)2个或3个字母的缩写词必须全部大写,4个或4个以上字母的缩写词必须首字母大写。
-- Chris Wilson(前微软员工)回答为什么 XMLHttpRequest 会有如此奇葩的大小写组合。
View decode_header.go
package main
import (
"fmt"
"golang.org/x/net/http2/hpack"
)
func main() {
fmt.Println("nginx", "→", Encode("MYWS"))
fmt.Println("nginx", "→", Encode("nginx"))
View react-server.go
package main
import (
"fmt"
"net/http"
"os"
"path"
"strconv"
)
View bitcoin_ser.md

https://blog.csdn.net/g2com/article/details/64904256

比特币客户端所有的序列化函数均在 seriliaze.h 中实现。其中,CDataStream类是数据序列化的核心结构。

CDataStream 拥有一个字符类容器用来存放序列化之后的数据。它结合一个容器类型和一个流(stream)API 以处理数据。

宏 READDATA() 和 WRITEDATA()