Skip to content

Instantly share code, notes, and snippets.

@snower
snower / logging_file_lock_handler.py
Created May 31, 2023 01:27
logging_file_lock_handler
# -*- coding: utf-8 -*-
# 14-8-20
# create by: snower
import os
import time
import struct
import fcntl
from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler
@snower
snower / event_test.java
Created May 11, 2023 09:45
Spring Boot Distributed Deferred Event
package com.aecg.cdtx.controller;
import io.github.snower.jaslock.Event;
import io.github.snower.jaslock.SlockClient;
import io.github.snower.jaslock.exceptions.SlockException;
import org.bson.types.ObjectId;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.async.DeferredResult;
import java.io.IOException;
@snower
snower / forward.py
Last active June 10, 2023 09:14
SSH、HTTP和HTTPS复用端口自动分流
# -*- coding: utf-8 -*-
# 2023/2/7
# create by: snower
import sevent
PORT = 80
SSH_ADDRES = ("127.0.0.1", 2222)
HTTP_ADDRES = ("127.0.0.1", 8080)
HTTPS_ADDRES = ("127.0.0.1", 4443)
@snower
snower / main.go
Created March 18, 2022 14:21
charles register
package main
import (
"bytes"
"encoding/binary"
"fmt"
"math/rand"
"time"
)
@snower
snower / arproxy.py
Last active January 15, 2022 11:14
arproxy
# -*- coding: utf-8 -*-
# 2020/7/10
# create by: snower
from sevent.helpers.tcp2proxy import *
def check_host(forward_host, allow_hosts):
for host in allow_hosts:
if forward_host == host or forward_host.endswith(host):
return True
@snower
snower / poll.conf
Created December 28, 2021 09:56
openresty long polling server
init_worker_by_lua_block {
local slock = require "slock"
slock:connect("server1", "127.0.0.1", 5658)
}
server {
listen 8081;
default_type application/json;
location /poll/event {
@snower
snower / tcp2proxys.py
Created August 19, 2021 14:14
tcp2proxys
# -*- coding: utf-8 -*-
# 2021/8/19
# create by: snower
import argparse
import logging
import sevent
from sevent.helpers import tcp2proxy
@snower
snower / check_ip.py
Last active December 28, 2021 09:57
check_ip
# -*- coding: utf-8 -*-
#14-6-6
# create by: snower
import struct
from collections import defaultdict
import socket
default_networds = (
@snower
snower / simple_proxy.py
Created July 9, 2020 03:10
simple_proxy
# -*- coding: utf-8 -*-
# 2020/7/8
# create by: snower
import sys
import time
import struct
import socket
import logging
import traceback
@snower
snower / tcp2proxy.py
Last active July 9, 2020 07:02
tcp2proxy
# -*- coding: utf-8 -*-
# 2020/3/4
# create by: snower
import sys
import time
import logging
import struct
import socket
import traceback