type Model interface {
comparable
TableName() (schema, table string)
}
type Change[T Model] struct {
New T
Old T
}
This file contains 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
const internal_priv = ECPair.fromPrivateKey( | |
Buffer.from( | |
"1229101a0fcf2104e8808dab35661134aa5903867d44deb73ce1c7e4eb925be8", | |
"hex", | |
), | |
); | |
const pub_key = toXOnly(internal_priv.publicKey); | |
const coldReserveScriptText1 = `${bitcoin.script.number | |
.encode(144) |
This file contains 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 mutator | |
import ( | |
"encoding/json" | |
"log" | |
"net/http" | |
admission "k8s.io/api/admission/v1" | |
corev1 "k8s.io/api/core/v1" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
) |
This file contains 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 authenticate | |
import ( | |
"encoding/json" | |
"errors" | |
"log" | |
"net/http" | |
"strings" | |
authentication "k8s.io/api/authentication/v1beta1" | |
) |
This file contains 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 validate | |
import ( | |
"encoding/json" | |
"log" | |
"net/http" | |
"regexp" | |
admission "k8s.io/api/admission/v1" | |
corev1 "k8s.io/api/core/v1" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
docker run -it --rm k8s.gcr.io/kube-apiserver:v1.19.0 kube-apiserver --help
docker run -it --rm k8s.gcr.io/kube-scheduler:v1.19.0 kube-scheduler --help
Custom Scheduler
apiVersion: v1
kind: Pod
This file contains 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
https://stackoverflow.com/questions/3324643/processes-threads-green-threads-protothreads-fibers-coroutines-whats-the | |
https://stackoverflow.com/questions/46864623/which-of-coroutines-goroutines-and-kotlin-coroutines-are-faster |
This file contains 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
var arrNum [5]int // this is an array | |
var sliceNum []int // this is a slice | |
fmt.Println(arrNum) // [5]int{0,0,0,0,0} array have initial value of zero value | |
fmt.Println(sliceNum) // []int(nil) slice have initial value of nil value | |
sliceNum == nil // true | |
arrNum[0] = 1 // ok | |
sliceNum[0] = 1 // compile time error because you cannot assign values to nil |
This file contains 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 bash | |
# https://mp.weixin.qq.com/s?__biz=MzA4MzIwNTc4NQ==&mid=2247484821&idx=1&sn=aaa173a8b913cc759c56efe05d2c15ad&chksm=9ffb4e63a88cc7755ca720b3886946245246d8e57687cf209ad47f61a186cc290c04ef57fc91&scene=21#wechat_redirect | |
function e_net() { | |
set -eu | |
pod=`kubectl get pod ${pod_name} -n ${namespace} -o template --template='{{range .status.containerStatuses}}{{.containerID}}{{end}}' | sed 's/docker:\/\/\(.*\)$/\1/'` | |
pid=`docker inspect -f {{.State.Pid}} $pod` | |
echo -e "\033[32m Entering pod netns for ${namespace}/${pod_name} \033[0m\n" | |
cmd="nsenter -n -t ${pid}" | |
echo -e "\033[32m Execute the command: ${cmd} \033[0m" |
NewerOlder