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 / main.py
Created Oct 22, 2016
Handle file upload by Tornado and Nginx Upload Module
View main.py
#!/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
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 'http://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
sh256 'c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
@cloverstd
cloverstd / install.sh
Last active Aug 15, 2020
install libtorrent and python binds on centos 7
View install.sh
yum install -y boost boost-devel
yum install -y make gcc gcc-c++ kernel-devel python-devel
wget https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_0_10/libtorrent-rasterbar-1.0.10.tar.gz
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 setup.py build
@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 / app.py
Last active Nov 4, 2019
微信二维码扫描登录
View app.py
#!/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
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))
You can’t perform that action at this time.