Skip to content

Instantly share code, notes, and snippets.

View ddcatgg's full-sized avatar

DDGG ddcatgg

  • Shanghai
View GitHub Profile
@ddcatgg
ddcatgg / asyncio_loop_in_thread.py
Created November 23, 2022 16:04 — forked from dmfigol/asyncio_loop_in_thread.py
Python asyncio event loop in a separate thread
"""
This gist shows how to run asyncio loop in a separate thread.
It could be useful if you want to mix sync and async code together.
Python 3.7+
"""
import asyncio
from datetime import datetime
from threading import Thread
from typing import Tuple, List, Iterable
@ddcatgg
ddcatgg / aioudp.py
Created November 23, 2022 15:57 — forked from vxgmichel/aioudp.py
High-level UDP endpoints for asyncio
"""Provide high-level UDP endpoints for asyncio.
Example:
async def main():
# Create a local UDP enpoint
local = await open_local_endpoint('localhost', 8888)
# Create a remote UDP enpoint, pointing to the first one
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import cookielib
import json
import tempfile
import mechanize
import re
import requests
@ddcatgg
ddcatgg / _eventlet_dns_hook_maker.py
Last active April 23, 2019 15:14
Make hook-eventlet.py for PyInstaller to solve the dns.* import issue.
import glob
lines = []
py_files = glob.glob('*.py')
for py_file in py_files:
if py_file.startswith('_'):
continue
if py_file.endswith('hook-eventlet.py'):
continue
line = "'dns.{}'".format(py_file[:-3])
@ddcatgg
ddcatgg / XiaoMi.md
Last active February 19, 2020 21:59

IMEI

IMEI(International Mobile Equipment Identity)

是国际移动设备身份码的缩写,国际移动装备辨识码,是由15位数字组成的"电子串号",它与每台移动电话机一一对应,而且该码是全世界唯一的。

小米2/2S最适合的MIUI版本