Skip to content

Instantly share code, notes, and snippets.

View sh7ning's full-sized avatar
👊
Go !

Shine Yim sh7ning

👊
Go !
View GitHub Profile
@sh7ning
sh7ning / golang_prometheus_metric_counter.go
Created May 10, 2022 08:59 — forked from ggzeng/golang_prometheus_metric_counter.go
prometheus golang 客户端中的各类metric写法
//step1:初始一个counter, with help string
pushCounter = prometheus.NewCounter(prometheus.CounterOpts{
Name: "repository_pushes",
Help: "Number of pushes to external repository.",
})
//setp2: 注册容器
err = prometheus.Register(pushCounter)
if err != nil {
fmt.Println("Push counter couldn't be registered AGAIN, no counting will happen:", err)
@sh7ning
sh7ning / main.go
Created April 2, 2022 01:37 — forked from jiahuif/main.go
golang: tunnel tcp over socks5
package main
import (
"flag"
"io"
"net"
"time"
log "github.com/sirupsen/logrus"
"golang.org/x/net/proxy"
@sh7ning
sh7ning / google_translate.go
Created December 24, 2021 05:26 — forked from mojocn/google_translate.go
free open google translate of golang
import (
"context"
"crypto/tls"
"errors"
"fmt"
"github.com/abadojack/whatlanggo"
"io/ioutil"
"net/http"
"net/url"
@sh7ning
sh7ning / 书籍.md
Last active October 10, 2020 06:20

入门

  • Python基础教程
  • C程序设计语言(机械工业出版)
  • 鸟哥的私房菜
  • Java编程思想

数据结构与算法

  • 算法导论(机械工业出版)
@sh7ning
sh7ning / k8s.md
Last active September 7, 2021 08:21
k8s note

K8S笔记

参考

多k8s集群配置切换配置

export KUBECONFIG=~/.kube/config.aws
@sh7ning
sh7ning / named_pipe.py
Last active March 18, 2020 03:50
进程通信demo
import os
import errno
import time
"""
The linux pipe buffers are implemnted as circular buffers[1].
A consequence of the circular buffer is that when it is full and a subsequent write is performed:
(a) then it starts overwriting the oldest data[2].
(b) Alternatively, the routines that manage the buffer could prevent overwriting the data and return an error or raise an exception.
package main

import (
	"fmt"

	"github.com/ThomasRooney/gexpect"
)

func main() {
@sh7ning
sh7ning / unsplash.py
Created September 3, 2019 22:19 — forked from ccbikai/unsplash.py
unsplash 全站下载脚本
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# unsplash 全站下载脚本
# 请先安装 requests ,BeautifulSoup
# pip install requests beautifulsoup4
# 运行 python unsplash.py
# 输入最小页数和最大页数
@sh7ning
sh7ning / golang-note.md
Last active June 2, 2021 07:56
Golang笔记

Golang Note

Ide 配置

  • Tools -> file wathers 中增加:
    • go fmt
      • 手动处理: gofmt -l -w .
    • goimports
      • 手动处理: goimports -l -w .
    • 自定义: go二进制 + 参数