import contextlib
import sys
def your_task():
print("The test !")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, let's create an awaitable object. | |
# In this case it's a very dumb container of integers. | |
# Any time a coroutine runs `await Thing(n)` it just resolves to n | |
# However, we could resolve it to something completely different if we wanted to | |
class Thing: | |
def __init__(self, n): | |
self._n = n | |
def __await__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
let data = fs.readFileSync('IRONCLAD.autosave.json', 'utf8'); | |
const out = []; | |
for (let i = 0; i < data.length; i++) { | |
const key = 'key'; | |
out.push(data.charCodeAt(i) ^ key.charCodeAt(i % key.length)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
WARNING: dont use loguru, use structlog | |
https://gist.github.com/nkhitrov/38adbb314f0d35371eba4ffb8f27078f | |
Configure handlers and formats for application loggers. | |
""" | |
import logging | |
import sys | |
from pprint import pformat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aecho.py | |
from socket import * | |
import asyncio | |
loop = asyncio.get_event_loop() | |
async def echo_server(address): | |
sock = socket(AF_INET, SOCK_STREAM) | |
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
China stock api | |
1.163_API(0-sh,1-sz):http://api.money.126.net/data/feed/1002151,0600036,hkHSI,hkHSCEI,hk00005 | |
2.QQ_API(sh,sz,s_simple data):http://qt.gtimg.cn/r=0.8409869808238q=s_sz000559,s_sz002434,s_sz002472,s_sz002488,hk00700 | |
3.sina_API(sh,sz,s_simple data):http://hq.sinajs.cn/list=sh600000,sh600004,hk00700,sz002594 | |
# 4.xueqiu_API:http://xueqiu.com/v4/stock/quote.json?code=02318,01211,SH000001,DJI30,HKHSI | |
163 | |
日内实时盘口(JSON): | |
http://api.money.126.net/data/feed/1000002,1000001,1000881,0601398,money.api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import asyncio | |
import multiprocessing | |
import os | |
import ssl | |
from time import sleep | |
port = 9000 |