This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local origin_pattern = [=[(\.hui\.lu|\.cloverstd\.com)(:\d+)?$]=] | |
local headers = ngx.req.get_headers() | |
ngx.header['Access-Control-Max-Age'] = '3600' | |
ngx.header['Access-Control-Allow-Credentials'] = 'true' | |
local origin = headers['Origin'] | |
if origin then | |
local m, err = ngx.re.match(origin, origin_pattern, "jo") | |
if m then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Probes *** | |
+ FPing | |
binary = /usr/bin/fping | |
+ Curl | |
binary = /usr/bin/curl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from Queue import Queue, Empty | |
import time | |
import threading | |
wait_q = Queue() | |
lock = threading.Lock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sign | |
import ( | |
"crypto/md5" | |
"encoding/hex" | |
"net/url" | |
"sort" | |
"strings" | |
) |