Skip to content

Instantly share code, notes, and snippets.

View EddieIvan01's full-sized avatar
:electron:

_ EddieIvan01

:electron:
  • \Device\KsecDD
  • 07:34 (UTC +08:00)
View GitHub Profile
@EddieIvan01
EddieIvan01 / murmur3hash_x86_32.rs
Created December 31, 2020 08:24
They all used unsafe raw pointer operations, so they are more fast then existing Rust implementations (2020.12.31)
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
}
@EddieIvan01
EddieIvan01 / raw_mode_posix.go
Created February 14, 2020 09:58
syscall to set raw-mode-input terminal in Go (Posix/Windows)
// +build darwin linux
package main
import (
"os"
"syscall"
"unsafe"
)
@EddieIvan01
EddieIvan01 / proxy_asyncio.py
Created February 17, 2019 06:46
multi I/O traffic forward. using select/epoll or asyncio lib
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:
@EddieIvan01
EddieIvan01 / async_decorator.py
Created February 11, 2019 08:58
async function decorator
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()