Skip to content

Instantly share code, notes, and snippets.

@xupengzhuo
xupengzhuo / aioudp.py
Created March 31, 2020 07:15 — 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
@xupengzhuo
xupengzhuo / pythonnet.py
Created November 18, 2017 11:52
pythonnet&cef&wpf
import clr
import sys
if sys.platform.lower() not in ['cli','win32']:
print("only windows is supported for wpf")
clr.AddReference(r"wpf\PresentationFramework")
from System.IO import StreamReader
from System.Windows.Markup import XamlReader
from System.Threading import Thread, ThreadStart, ApartmentState
from System.Windows import Application, Window, WindowState
@xupengzhuo
xupengzhuo / pipe.py
Last active February 8, 2025 08:03
transfer pickle using pipe
##########
#parent.py
##########
import subprocess
import pickle
process = subprocess.Popen(
['python', 'child.py'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
bufsize=0
apt-get update
apt-get upgrade
apt-get install git
git clone -b manyuser https://github.com/shadowsocksr-backup/shadowsocksr.git
cd shadowsocksr/
apt-get install build-essential
wget https://github.com/jedisct1/libsodium/releases/download/1.0.12/libsodium-1.0.12.tar.gz
@xupengzhuo
xupengzhuo / n.html
Last active June 6, 2017 10:10
给定一个数,获取和为这个数的组合并输出
<!doctype HTML>
<head>
<style>
.green {
color: green;
}
</style>
</head>
@xupengzhuo
xupengzhuo / 简单加密解密函数
Last active August 29, 2015 14:08
用于32位的unsigned int数据加密解密
<?php
function api_encode_uid($uid)
{
$sid = ($uid & 0x0000ff00) << 16;
$sid += (($uid & 0xff000000) >> 8) & 0x00ff0000;
$sid += ($uid & 0x000000ff) << 8;
$sid += ($uid & 0x00ff0000) >> 16;
$sid ^= 282335;