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
from functools import wraps | |
from threading import Thread | |
from queue import Queue | |
class Async(object): | |
__slots__ = ('__result', '__task') | |
def __init__(self, func): | |
self.__result = 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 asyncio | |
async def proxy_pass(reader, writer): | |
socks_r, socks_w = await asyncio.open_connection('127.0.0.1', 1080) | |
async def a_2_b(reader, writer): | |
data = await reader.read(4096) | |
while 1: | |
try: |
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
fn fmix32(mut h: u32) -> u32 { | |
h ^= h >> 16; | |
h = h.wrapping_mul(0x85ebca6b); | |
h ^= h >> 13; | |
h = h.wrapping_mul(0xc2b2ae35); | |
h ^= h >> 16; | |
h | |
} |
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
// +build darwin linux | |
package main | |
import ( | |
"os" | |
"syscall" | |
"unsafe" | |
) |