Skip to content

Instantly share code, notes, and snippets.

View guesslin's full-sized avatar

Yu-han Lin guesslin

View GitHub Profile
package main
import (
"fmt"
"os"
)
func IncorrectCloseFile(json_data []byte) {
//create json file
json_file, err := os.Create("sample.json")
package main
import (
"errors"
"fmt"
"time"
)
func main() {
check(extractTime(nil))
packet main
import "fmt"
func HexPacket(raw []byte) {
idx := 0
for ; idx < len(raw)-16; idx += 16 {
fmt.Printf("%04X: ", idx)
for i := 0; i < 16; i++ {
fmt.Printf("%02X ", raw[idx+i])
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: some_microservice
spec:
host: some_microservice_host
trafficPolicy:
connectionPool:
tcp:
maxConnections: 10
/*
how to build (based on docker image golang:1.10):
$ apt-get update -qq && \
apt-get install -y pkg-config libpcap-dev curl cmake patch git libnuma-dev linux-source-4.9 libzmq3-dev unzip clang llvm libelf-dev && \
apt-get install -y --no-install-recommends bsdtar
# Prepare kernel and compile/install netmap/dpdk
$ cd /usr/src && \
bsdtar xJf linux-source-4.9.tar.xz && \
/*
$ ./chanBench
Use Channel
Use Channel runs 1014856858 in 5 seconds, average 202971371 calls/s
Use Atomic
Use Channel runs 16146198617 in 5 seconds, average 3229239723 calls/s
*/
package main
package main
import (
"fmt"
)
type Small interface {
Foo(int) int
}
#!/bin/bash
# ssh -i <ssh_key> azureuser@<acs_fqdn> bash install-omsagent.sh -w <oms_wid> -s <oms_sharedkey> -ssh=</path/to/ssh-key-file>
while [[ $# -gt 0 ]]; do
key="$1"
case "$key" in
-w)
OMS_WORKSPACE="$2"
shift
;;
package main
import (
"fmt"
)
type NameFn func() string
func delegate(name string) func() string {
return func() string {
package main
import (
"fmt"
"reflect"
)
type Docs struct {
Github string
Linkedin string