Skip to content

Instantly share code, notes, and snippets.

View xigang's full-sized avatar
🎾
/*happy coding*/

Xigang Wang xigang

🎾
/*happy coding*/
View GitHub Profile
@xigang
xigang / gist:3c8f222df2d5a9e881d6b35be34aa5b7
Created March 19, 2023 13:34
pod informer cache test case
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"path/filepath"
"time"
@xigang
xigang / bytes_split.go
Created July 4, 2020 08:12 — forked from xlab/bytes_split.go
Golang split byte slice in chunks sized by limit
func split(buf []byte, lim int) [][]byte {
var chunk []byte
chunks := make([][]byte, 0, len(buf)/lim+1)
for len(buf) >= lim {
chunk, buf = buf[:lim], buf[lim:]
chunks = append(chunks, chunk)
}
if len(buf) > 0 {
chunks = append(chunks, buf[:len(buf)])
}
@xigang
xigang / gist:b0291256946355238a41b5994e80103d
Created June 23, 2020 08:55
Sublime Text 3 license key 2020 Updated and working perfectly
Thanks GUys use this oone
----- BEGIN LICENSE -----
Member J2TeaM
Single User License
EA7E-1011316
D7DA350E 1B8B0760 972F8B60 F3E64036
B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD
FA0A2ABE 25F65BD8 D51458E5 3923CE80
87428428 79079A01 AA69F319 A1AF29A4
@xigang
xigang / LICENCE SUBLIME TEXT
Created May 4, 2020 03:02 — forked from guruskid/LICENCE SUBLIME TEXT
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@xigang
xigang / retry.go
Created October 12, 2019 03:19
retry.go
type ConditionFunc func() (bool, error)
// Retry retries f every interval until after maxRetries.
// The interval won't be affected by how long f takes.
// For example, if interval is 3s, f takes 1s, another f will be called 2s later.
// However, if f takes longer than interval, it will be delayed.
func Retry(interval time.Duration, maxRetries int, f ConditionFunc) error {
if maxRetries <= 0 {
return fmt.Errorf("maxRetries (%d) should be > 0", maxRetries)
}
@xigang
xigang / coredns.yaml
Created August 6, 2019 09:52
install coredns for kubernetes cluster.
apiVersion: v1
kind: ServiceAccount
metadata:
name: coredns
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
@xigang
xigang / helm_rbac_config.yaml
Created June 12, 2019 13:14
hlem rbac config
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tiller
@xigang
xigang / helm_repo.txt
Created June 12, 2019 13:10
helm国内mirror
感谢分享! 貌似azure也提供了镜像。
stable http://mirror.azure.cn/kubernetes/charts/
incubator http://mirror.azure.cn/kubernetes/charts-incubator/
@xigang
xigang / build_contianerd.sh
Created June 3, 2019 11:26
build containerd Dependency package
You need the following packages installed.
btrfs-progs-devel-3.16.2-1.el7.x86_64
btrfs-progs-3.16.2-1.el7.x86_64
In the absence of that you can do a make docker-build
I also checked in conditional compilation for btrfs if you don't have the packages installed. So if you get the latest, you should be able to build without the btrfs packages.
@xigang
xigang / main.go
Created April 22, 2019 05:04
Compress memory usage, including cache
package main
import (
"fmt"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus/promhttp"
)