Skip to content

Instantly share code, notes, and snippets.

View lwzm's full-sized avatar
🎯
Focusing

Weizhao Li lwzm

🎯
Focusing
View GitHub Profile
python3 -c 'for n in range(256): print(f"{n:02x}")' | xargs -n1 -P5 ./your-app
#!/usr/bin/env python3
from codecs import decode, encode
from hashlib import md5
from json import dumps, loads
from Crypto.Cipher import AES
N = 16
from json import dumps
from traceback import print_exc
class TcpLog:
def __init__(self, addr):
host, port = addr.split(":")
self._address = host, int(port)
self._socket = None
self._message = b''
#!/usr/bin/env python3
import csv
import sys
for i in csv.reader(sys.stdin):
print(*i, sep="\t")
@lwzm
lwzm / msg.py
Last active April 13, 2020 11:47
#!/usr/bin/env python3
import collections
from asyncio import Future
from typing import Dict, List, Tuple
from fastapi import FastAPI, HTTPException, Request
todos: Dict[str, List[Tuple[Future, Request]]] = collections.defaultdict(list)
app = FastAPI()
@lwzm
lwzm / ddns.py
Last active January 14, 2020 03:46
#!/usr/bin/env python3
import requests
def update_dnspod(sub_domain, ip):
token = '49794,a259c8cdfc221e32078e867fdfea0415'
session = requests.Session()
session.headers["User-Agent"] = "Py/3.x ([email protected])"
data = {
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func init() {
@lwzm
lwzm / cli.sh
Last active December 25, 2019 01:54
dd if=/dev/zero bs=1M count=1000 | curl -T - localhost:1111
curl -T /dev/urandom localhost:1111
@lwzm
lwzm / m.py
Last active December 18, 2019 09:18
#!/usr/bin/env python3
import multiprocessing.connection
import os
import time
import signal
def wait(*_):
while True:
@lwzm
lwzm / notice.py
Last active December 2, 2019 02:17
#!/usr/bin/env python3
import asyncio
import collections
import tornado.web
class Base(tornado.web.RequestHandler):
_futures = collections.defaultdict(set)