This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Chrome测试,Wireshark抓 curl、okhttp3、chrome的包 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @startuml state-sample | |
| ' 下面一行代码引入新样式,在线查看效果 https://www.plantuml.com/plantuml/svg/RP8_Ry8m4CLtVuhhKgIg8KidXeeAqJ8WG1IfGrLLRd8a5ewTdkrI-kbxIO24FvlztldtpcSFdPVaGw615nuZ9ujIexXH9j4XnK0QSkzBDuXZajj-fdmUle93IgpnQ7m_iKNy6wJPOLngQIfKvFnEOvGyn8Lq7YbEB66_P4Vq81W-KV19y3d2scfjjyfae9L1a2Q54rkHuvK5JWHj4wdrJlGEpK7B5I_ByNZs-RHSpj-4yCfhXCbgjO0bVWTanaAIgs9Ugriw8TxlFY2A7W_-bDE5w6nWK1zfA6S6xPbLooTM1PoWJ94Sbyqt5-QOo19RprBfG9pOLdVIMZ5lLaUb3h0SNTExwYMvAHlbc6mWvyr1QPYW79I4ZYVT61LaYYRpETVCh8Sa3sQ3QUkE6g66dbaNwKTIaw_MzT0KONhVUZzIgnHkmQa_FAZNQ5UiiU4tti7AMfXAoavgggUjvoFQZZlJRSNwXljv7ELh3NIzbZv4a_BV-mS0 | |
| !includeurl https://raw.githubusercontent.com/xuanye/plantuml-style-c4/master/core.puml | |
| ' uncomment the following line and comment the first to use locally | |
| '!include core.puml | |
| GREEN_ARROW | |
| title HTTP Request Parsing States |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "reflect" | |
| "fmt" | |
| ) | |
| func main() { | |
| x := 42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.liufor.javaagent; | |
| import net.bytebuddy.agent.ByteBuddyAgent; | |
| import net.bytebuddy.agent.builder.AgentBuilder; | |
| import net.bytebuddy.description.type.TypeDescription; | |
| import net.bytebuddy.dynamic.DynamicType; | |
| import net.bytebuddy.implementation.FixedValue; | |
| import net.bytebuddy.utility.JavaModule; | |
| import static net.bytebuddy.matcher.ElementMatchers.named; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| slice append 前后的地址是一样的,那slice的不变性怎样实现的呢? | |
| 0xc000098020,0xc000098020 | |
| %p on slice 只能取到slice backen array的第0个元素地址,并不是slice自己的address | |
| ref:https://golang.org/pkg/fmt/ (%p address of 0th element in base 16 notation, with leading 0x) | |
| 4个地址相同 | |
| address:0xc0000a6000 = 0xc0000a6000 =0xc0000a6000 = 0xc0000a6000 | |
| &sli 才能取到slice本身的地址 | |
| %p,&slice is address of slice self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "encoding/hex" | |
| "strconv" | |
| ) | |
| //单个Hex转为bit string. | |
| func HexToBin(hex string) (string, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "log" | |
| "os" | |
| "os/signal" | |
| "syscall" | |
| ) | |
| func AddShutdownHook(hooks ...func()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| func describe(x interface{}) { | |
| fmt.Printf("%v,%T\n", x, x) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "time" | |
| ) | |
| var start time.Time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "time" | |
| ) | |
| func main() { | |
| //go doc time.Duration | |
| time.Sleep(1000 * 1000 * 1000 * 2) //2s, 默认是, 默认是纳秒ns, type Duration int64 | |
| time.Sleep(2 * time.Second) //2s |
NewerOlder