Skip to content

Instantly share code, notes, and snippets.

View hongchaodeng's full-sized avatar
👋
Anyscale is hiring! Send your resume to hongchao.deng@anyscale.com

Hongchao Deng hongchaodeng

👋
Anyscale is hiring! Send your resume to hongchao.deng@anyscale.com
View GitHub Profile
@hongchaodeng
hongchaodeng / ca-config.json
Last active November 29, 2017 09:47
Generate Secrets
{
"signing": {
"default": {
"expiry": "43800h"
},
"profiles": {
"server": {
"expiry": "43800h",
"usages": [
"signing",
package main
import (
"context"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
@hongchaodeng
hongchaodeng / ca-config.json
Last active April 5, 2017 05:17
self-hosted etcd tls
{
"signing": {
"default": {
"expiry": "43800h"
},
"profiles": {
"server": {
"expiry": "43800h",
"usages": [
"signing",
# Generated by iptables-save v1.4.21 on Tue Feb 21 01:00:01 2017
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:DOCKER - [0:0]
:KUBE-HOSTPORTS - [0:0]
:KUBE-MARK-DROP - [0:0]
:KUBE-MARK-MASQ - [0:0]
@hongchaodeng
hongchaodeng / latency.go
Created September 17, 2016 00:00
watch response latency
package main
import (
"flag"
"fmt"
"os"
"runtime"
"sync/atomic"
"time"
type Interface interface {
// Put puts an object on a key.
// if prevVersion < 0, we will set the object with current largest resource version,
// put the object on the key, and returns the stored object.
// If prevVersion >= 0, we will use it to do Compare-And-Swap against existing object's resource version.
// Note that prevVersion = 0 means no previous object on given key.
// - If compare failed, it will return current object (nil if non-exist) and StorageError of VersionConflicts.
// - If compare succeed, it will behave like "prevVersion < 0".
type Storage interface {
// Put...
// if prevVersion < 0, we will set the object with current largest resource version,
// put the object on the key, and returns the stored object.
// If prevVersion >= 0, we will use it to do Compare-And-Swap against existing object's resource version.
// Note that prevVersion = 0 means no previous object on given key.
// - If compare failed, it will return current object (nil if non-exist) and StorageError of VersionConflicts.
// - If compare succeed, it will behave like "prevVersion < 0".
Put(key string, obj runtime.Object, prevVersion int64) (cur runtime.Object, err error)
@hongchaodeng
hongchaodeng / interface.go
Last active January 30, 2016 19:02
schedulercache interface.go
package schedulercache
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/labels"
)
// Cache collects pods' information and provides node-level aggregated information.
// It's intended for generic scheduler to do efficient lookup.
@hongchaodeng
hongchaodeng / error.log
Created February 7, 2015 04:23
etcd cluster test
? github.com/go-distributed/meritop [no test files]
=== RUN TestControllerInitEtcdLayout
2015/02/06 20:22:32 etcdserver: name = controller_test
2015/02/06 20:22:32 etcdserver: data dir = /var/folders/6g/r7fwqcld2s95n7p8hx5pdbl40000gp/T/etcd902684176
2015/02/06 20:22:32 etcdserver: heartbeat = 10ms
2015/02/06 20:22:32 etcdserver: election = 100ms
2015/02/06 20:22:32 etcdserver: snapshot count = 0
2015/02/06 20:22:32 etcdserver: advertise client URLs = http://127.0.0.1:64518
2015/02/06 20:22:32 etcdserver: initial advertise peer URLs = http://127.0.0.1:64517
2015/02/06 20:22:32 etcdserver: initial cluster = controller_test=http://127.0.0.1:64517
@hongchaodeng
hongchaodeng / osx_protoc.md
Created July 7, 2014 01:45
OSX protoc version

OSX homebrew can install protobuf. But the default is protobuf 2.5 at the time. All you have to do is to type the following after install protobuf241.

brew link --force --overwrite protobuf241