Skip to content

Instantly share code, notes, and snippets.

View x893675's full-sized avatar
:octocat:
🐳 ☸️

Hanamichi x893675

:octocat:
🐳 ☸️
View GitHub Profile
@x893675
x893675 / http2.go
Created October 18, 2020 00:32
http2 server
package main
import (
"context"
"crypto/tls"
"fmt"
"golang.org/x/net/http2"
"golang.org/x/sys/unix"
"io"
"io/ioutil"
package main
import "fmt"
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
package main
import (
"fmt"
"unsafe"
)
type StringHeader struct {
Data uintptr
Len int
package main
import (
"fmt"
"runtime"
"sync"
)
func main() {
testA()
@x893675
x893675 / bcrypt_password.go
Created September 3, 2020 07:49
store password by bcrypt
package main
import (
"golang.org/x/crypto/bcrypt"
"log"
)
// bcrypt主要由四部分组成
// Prefix说明了使用的bcrypt的版本
// Cost是进行哈希的次数-数字越大生成bcrypt的速度越慢,成本越大。同样也意味着如果密码库被盗,攻击者想通过暴力破解的方法猜测出用户密码的成本变得越昂贵。
@x893675
x893675 / golang-sse
Created August 17, 2020 03:07
server sent event
package main
import (
"fmt"
"log"
"net/http"
)
var messageChan chan string
package main
// docker client package version error, always import github.com/docker/docker v1.13.1
// Issue: https://github.com/moby/moby/issues/39302
import (
"context"
"github.com/docker/docker/client"
"github.com/emicklei/go-restful"
"io"
"log"
package main
// docker client package version error, always import github.com/docker/docker v1.13.1
// Issue: https://github.com/moby/moby/issues/39302
import (
"context"
"fmt"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
@x893675
x893675 / rawjson.go
Created July 22, 2020 09:22
response json raw message
package main
import (
"encoding/json"
"log"
"net/http"
)
type TestJson struct {
//Str is json string
@x893675
x893675 / 🎮 最近我在玩…
Last active May 1, 2025 02:18
🎮 Game Play
🎮 AI Limit 🕘 2 hrs 19 mins