Skip to content

Instantly share code, notes, and snippets.

Working for living

cloverstd cloverstd

Working for living
View GitHub Profile
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))))
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 /
Created Oct 22, 2016
Handle file upload by Tornado and Nginx Upload Module
#!/usr/bin/env python
# encoding: utf-8
import tornado.ioloop
import tornado.web
import tornado.log
import tornado.httpserver
from tornado.options import define, options
import logging
import tornado.gen
cloverstd / sshpass.rb
Last active Aug 17, 2020 — forked from lalyos/sshpass.rb
brew install sshpass
View sshpass.rb
require 'formula'
class Sshpass < Formula
url ''
homepage ''
sh256 'c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
cloverstd /
Last active Aug 15, 2020
install libtorrent and python binds on centos 7
yum install -y boost boost-devel
yum install -y make gcc gcc-c++ kernel-devel python-devel
tar zxvf libtorrent-rasterbar-1.0.10.tar.gz
cd libtorrent-rasterbar-1.0.10.tar.gz
./configure --disable-debug --with-boost-libdir=/usr/lib64 --disable-encryption --enable-python-binding
make && make install
export LD_LIBRARY_PATH=/usr/local/lib/
cd bindings/python
python build
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 / Probes
Created Mar 22, 2020
smokeping config
View Probes
*** Probes ***
+ FPing
binary = /usr/bin/fping
+ Curl
binary = /usr/bin/curl
import requests
from Queue import Queue, Empty
import time
import threading
wait_q = Queue()
lock = threading.Lock()
cloverstd /
Last active Nov 4, 2019
#!/usr/bin/env python
# encoding: utf-8
import tornado.ioloop
import tornado.httpclient
import tornado.web
import tornado.gen
import json
import tornado.websocket
import Queue
cloverstd /
Last active Sep 6, 2019
a cheap tcp check
import socket
import struct
import time
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(('', 9999))
You can’t perform that action at this time.