Skip to content

Instantly share code, notes, and snippets.

View wilkice's full-sized avatar
😁
Focusing

darcy wilkice

😁
Focusing
  • Earth
  • 12:20 (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 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 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 02:45
[nginx load balance by full client ip] #nginx #linux
   upstream apachereadonly  {
     server 10.10.11.10:8011; 
     server 10.10.11.11:8011; 
     server 10.10.11.12:8011; 
	 hash $remote_addr consistent;
   }

Please note the ip_hash of nginx only cares the first thress parts of client ip, so 10.0.0.1/24 all will go to the same backend server.

@wilkice
wilkice / a.md
Created December 7, 2021 06:33
[Docker ubuntu mirror] #docker

Docker 中 Ubuntu 的源设置

  1. 在制作镜像的目录下新建文件 sources.list。新建过程及内容见阿里云镜像源
  2. 在 Dockerfile 中 FROM ubuntu:latest 之后添加如下内容:
    COPY sources.list /etc/apt/sources.list
    
@wilkice
wilkice / main.py
Created November 12, 2021 09:06
[requsts proxy] use proxy to do requests #py
import requests
import json
url = 'https://httpbin.org/get'
proxies = {
'http': 'http://127.0.0.1:7890',
'https': 'http://127.0.0.1:7890',
}
r = requests.get(url, proxies=proxies)