Skip to content

Instantly share code, notes, and snippets.

View wilkice's full-sized avatar
😁
Focusing

darcy wilkice

😁
Focusing
  • Earth
  • 00:24 (UTC +08:00)
View GitHub Profile
@wilkice
wilkice / k3s.sh
Last active October 18, 2022 14:59
k3s dev setup
# get k3s and disable traefik
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" INSTALL_K3S_EXEC="--disable=traefik" sh -
# install helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# install nginx ingress: https://kubernetes.github.io/ingress-nginx/deploy/#quick-start
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace
@wilkice
wilkice / a.md
Created February 14, 2022 06:49
offline package install #dev

yum

yum install --downloadonly --downloaddir=./yum-packages tree
@wilkice
wilkice / a.md
Last active January 30, 2022 16:06
table schema #MySQL
  • last modified date auto update
    `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
@wilkice
wilkice / a.md
Last active January 27, 2022 16:57
常用SQL #sql

show db disk usage

select table_schema, sum((data_length+index_length)/1024/1024) AS "Total size(table+index) Mb", sum(data_length/1024/1024) as "table size", sum(index_length/1024/1024) as "index size" from information_schema.tables group by table_schema;
@wilkice
wilkice / a.md
Created January 19, 2022 10:19
[16 进制转换] #dev

16 进制需要先转为 10 进制的 byte,然后 byte 和 str 相互转换

Python

# ascii str to hex str
"hello".encode().hex()  # '68656c6c6f'

# hex str to ascii
bytes.fromhex("68656c6c6f").decode()  # "hello"
@wilkice
wilkice / a.md
Last active January 5, 2022 07:35
[hash and encry] #dev

摘要算法: 返回固定长度的字符串

md5: 128 bit

SHA-1: 160 bit

SHA-2(SHA-256): 256 bit, 64 hex

加密算法

@wilkice
wilkice / a.md
Last active December 30, 2021 08:04
[Vscode 图床] #dev

VsCode 本身对于 Markdown 编写来说是足够的,但是没有办法直接插入图片。在这里分享我最近查找到的一种方式,主要是利用 vs-picgo 这个插件来实现的,图片保存在了腾讯云的 COS 中

Vscode 设置中插件的配置类似为

{
    "picgo.picBed.tcyun.appId": "xxx",
    "picgo.picBed.tcyun.secretId": "xxxx",
    "picgo.picBed.tcyun.secretKey": "xxxx",
    "picgo.picBed.current": "tcyun",
 "picgo.picBed.tcyun.area": "ap-guangzhou",
@wilkice
wilkice / main.go
Created December 24, 2021 07:30
[hex, int, string]
package main
import (
"fmt"
"strconv"
"encoding/hex"
)
func main() {
// "A"
@wilkice
wilkice / a.go
Created December 17, 2021 07:46
[go execute command]
package main
import (
"log"
"os/exec"
)
func main() {
cmd := exec.Command("aaa", "-za")
output, err := cmd.CombinedOutput()
@wilkice
wilkice / a.md
Created December 15, 2021 03:33
[semantic version] #dev

three parts

Major.Minor.Patch

increment Major if make backward incompatible changes. increment Minor if make backward compatible changes, specially functionality not bug fix. increment Patch if make bug fix not affecting anything.

If version is released, you can't change it. You should make a new release if there is something to change.