Skip to content

Instantly share code, notes, and snippets.

View Chever-John's full-sized avatar
👋
Coding

Chever John Chever-John

👋
Coding
View GitHub Profile
@Chever-John
Chever-John / README.md
Created October 31, 2023 01:00 — forked from zoilomora/README.md
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

Parse the kubernetes manifest in yaml or json, don't care a manifest type.

Examples:

package main

import (
	"bytes"
	"context"
@Chever-John
Chever-John / check.go
Created February 4, 2023 03:44 — forked from mattes/check.go
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@Chever-John
Chever-John / ccoc.sh
Last active November 7, 2022 03:24
Common commands of ctr
ctr image pull docker.io/library/hello-world
ctr image pull docker.io/library/hello-world:latest
ctr image ls
ctr image ls -q
ctr c create docker.io/library/hello-world:latest demo
ctr c list
ctr image remove docker.io/library/hello-world:latest
ctr c list
ctr c remove demo
@Chever-John
Chever-John / k8s-install.md
Created October 27, 2022 01:10 — forked from islishude/k8s-install.md
k8s-国内源安装

MOVE TO HERE

注意以下命令,需要切换到 root 后运行

安装 docker

首先确定已经安装完成 docker,如果没有安装可以使用以下脚本快速安装并配置:

Problem

The go command line tool needs to be able to fetch dependencies from your private GitLab, but authenticaiton is required.

This assumes your private GitLab is hosted at privategitlab.company.com.

Environment variables

The following environment variables are recommended:

export GO111MODULE=on
export GOPRIVATE=privategitlab.company.com
@Chever-John
Chever-John / gist:485afe2a502bf7b5bf944a5716eaaa6d
Last active September 5, 2022 16:48
After installing Ubuntu
sudo apt-get install git
git config --global user.name "CheverJohn"
git config --global user.email "cheverjonathan@gmail.com"
// start etcd
nohup etcd &
// stop etcd
kill `pgrep etcd`
// get all route info
etcdctl get / --prefix --keys-only
// delete all route info
@Chever-John
Chever-John / kubectl
Last active August 30, 2022 04:59
some commands about kubectl
kubectl delete pods --all --all-namespaces
kubectl delete pod websocket-server-service
kubectl delete --all pods --namespace=foo
kubectl delete --all deployments --namespace=foo
kubectl delete --all namespaces
```bash
@Chever-John
Chever-John / simulate-a-set.go
Last active April 10, 2022 15:55
Using map[...]bool to simulate a set in golang.
package main
import "fmt"
var validNames = map[string]bool{
"blue": true,
"yellow": true,
}
func main() {