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
# from https://www.zhihu.com/people/tou-gou-bao-da | |
package main | |
import ( | |
"fmt" | |
"math" | |
"math/rand" | |
"reflect" | |
"runtime" | |
"sort" |
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 pb | |
import ( | |
"fmt" | |
"reflect" | |
st "github.com/golang/protobuf/ptypes/struct" | |
) | |
// ToStruct converts a map[string]interface{} to a ptypes.Struct |
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
local ffi = require("ffi") | |
local awesome = ffi.load("./awesome.so") | |
ffi.cdef([[ | |
typedef long long GoInt64; | |
typedef unsigned long long GoUint64; | |
typedef GoInt64 GoInt; | |
typedef GoUint64 GoUint; | |
typedef double GoFloat64; |
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
#!/usr/bin/env python | |
""" | |
An example of how to remove comments and trailing commas from JSON before | |
parsing. You only need the two functions below, `remove_comments()` and | |
`remove_trailing_commas()` to accomplish this. This script serves as an | |
example of how to use them but feel free to just copy & paste them into your | |
own code/projects. Usage:: | |
json_cleaner.py some_file.json |
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
type ApacheLogRecord struct { | |
http.ResponseWriter | |
ip string | |
time time.Time | |
method, uri, protocol string | |
status int | |
responseBytes int64 | |
elapsedTime time.Duration | |
} |