Skip to content

Instantly share code, notes, and snippets.

View cloverstd's full-sized avatar
🀄
Working for living

cloverstd cloverstd

🀄
Working for living
View GitHub Profile
@cloverstd
cloverstd / Probes
Created March 22, 2020 12:46
smokeping config
*** Probes ***
+ FPing
binary = /usr/bin/fping
+ Curl
binary = /usr/bin/curl
@cloverstd
cloverstd / thread.py
Created December 26, 2019 18:28
多线程
import requests
from Queue import Queue, Empty
import time
import threading
wait_q = Queue()
lock = threading.Lock()
@cloverstd
cloverstd / check.py
Last active September 6, 2019 03:18
a cheap tcp check
import socket
import struct
import time
# https://github.com/tevino/tcp-shaker
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_TCP, socket.TCP_QUICKACK, 0) # disable TCP_QUICKACK
s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0)) # diable liner, send RST to close
s.connect(('127.0.0.1', 9999))
@cloverstd
cloverstd / setup.sh
Created September 4, 2019 09:03
vultr ipv6 setup
sudo apt-get install ndisc6 # install rdsic6
sudo rdisc6 ens3 # search ens3 iface info, the last line from block is your gateway
sudo ip -6 route add default via YOUR_GATEWAY_FROM_rdisc6 dev ens3
package sign
import (
"crypto/md5"
"encoding/hex"
"net/url"
"sort"
"strings"
)
package sign
import (
"crypto/md5"
"encoding/hex"
"net/url"
"sort"
"strings"
)
@cloverstd
cloverstd / json_test.go
Created July 16, 2018 04:15
benchmark with json
package main_test
import (
"encoding/json"
"testing"
)
func BenchmarkJSONMarshalStruct(b *testing.B) {
type Foo struct {
Name string `json:"name"`
@cloverstd
cloverstd / tcp-chcker.py
Last active July 8, 2018 03:50
tcp check
#!/usr/bin/env python
# encoding: utf-8
import socket
import struct
import select
import errno
import time
# https://github.com/tevino/tcp-shaker
@cloverstd
cloverstd / byte_to_ascii.go
Created December 27, 2017 09:42
convert []byte to ascii
package main
import (
"fmt"
"strconv"
)
func main() {
// a := map[string]interface{}{
// "中文": map[string]interface{}{
@cloverstd
cloverstd / qiniu.go
Last active July 21, 2017 08:07
Docker registry V2 qiniu storage,镜像仓库七牛驱动,https://hui.lu/docker-registry-storage/
package qiniu
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"