Skip to content

Instantly share code, notes, and snippets.

Avatar
🀄
Working for living

cloverstd cloverstd

🀄
Working for living
View GitHub Profile
@cloverstd
cloverstd / main.go
Created Sep 24, 2020
access value via unsafe
View main.go
func main() {
var i interface{} = 100
/**
type eface struct {
_type *_type
data unsafe.Pointer
}
*/
n := *(*int)(*(*unsafe.Pointer)(unsafe.Pointer(uintptr(unsafe.Pointer(&i)) + unsafe.Alignof(i))))
fmt.Println(n)
@cloverstd
cloverstd / config.yml
Last active Aug 24, 2020
clash 旁路由配置
View config.yml
mixed-port: 17890
redir-port: 17892
allow-lan: true
mode: rule
log-level: info
@cloverstd
cloverstd / recover.js
Created Mar 29, 2020
坚果云恢复文件
View recover.js
function getParams() {
const pairs = window.location.hash.substr(1).split('::');
if (!pairs) {
throw new Error('取不到参数');
}
return {
sndId: pairs[1].split('=')[1],
sndMagic: pairs[2].split('=')[1]
};
}
@cloverstd
cloverstd / Probes
Created Mar 22, 2020
smokeping config
View Probes
*** Probes ***
+ FPing
binary = /usr/bin/fping
+ Curl
binary = /usr/bin/curl
View thread.py
import requests
from Queue import Queue, Empty
import time
import threading
wait_q = Queue()
lock = threading.Lock()
@cloverstd
cloverstd / check.py
Last active Sep 6, 2019
a cheap tcp check
View check.py
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 Sep 4, 2019
vultr ipv6 setup
View setup.sh
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
View taobao_sign.go
package sign
import (
"crypto/md5"
"encoding/hex"
"net/url"
"sort"
"strings"
)
View taobao_sign.go
package sign
import (
"crypto/md5"
"encoding/hex"
"net/url"
"sort"
"strings"
)
@cloverstd
cloverstd / json_test.go
Created Jul 16, 2018
benchmark with json
View json_test.go
package main_test
import (
"encoding/json"
"testing"
)
func BenchmarkJSONMarshalStruct(b *testing.B) {
type Foo struct {
Name string `json:"name"`
You can’t perform that action at this time.