vim time_logger.py
import os
import logging
import time
current_dir = os.path.abspath(os.path.dirname(__file__))
| import asyncore | |
| connected_sockets = dict() | |
| class SocketHandler(asyncore.dispatcher_with_send): | |
| def handle_read(self): | |
| data = self.recv(8192) | |
| #print(connected_sockets) | |
| if data: | |
| for i in [i for i in connected_sockets.values() if i != self.socket]: |
| import asyncore | |
| import threading | |
| class MySocketClient(asyncore.dispatcher): | |
| def __init__(self, server_address): | |
| asyncore.dispatcher.__init__(self) | |
| self.create_socket() | |
| self.connect(server_address) | |
| def handle_read(self): |
| import asyncio | |
| class EchoServerClientProtocol(asyncio.Protocol): | |
| def connection_made(self, transport): | |
| self.transport = transport | |
| self.peername = transport.get_extra_info('peername') | |
| print('Connection from {}'.format(self.peername)) | |
| def data_received(self, data): |
| import asyncio | |
| import threading | |
| class EchoClientProtocol(asyncio.Protocol): | |
| def __init__(self, message, loop): | |
| self.message = message | |
| self.loop = loop | |
| def connection_made(self, transport): | |
| transport.write(self.message.encode()) |
| import asyncio | |
| import threading | |
| import time | |
| connected_transport = dict() | |
| class ServerClientProtocol(asyncio.Protocol): |
| import asyncio | |
| import threading | |
| import time | |
| from datetime import datetime | |
| SERVER_ADDRESS = '127.0.0.1' # server address | |
| PORT = 8888 |
| # https://docs.sqlalchemy.org/en/latest/orm/tutorial.html | |
| # https://bytefish.de/blog/first_steps_with_sqlalchemy/ | |
| from pprint import pprint | |
| import os | |
| if os.path.exists('userdata.sqlite'): | |
| os.remove('userdata.sqlite') # not necessarily, just for testing | |
| from sqlalchemy import create_engine |
| import numpy as np | |
| import pylab | |
| class MathDraw(): | |
| def __init__(self, func): | |
| self.f = func | |
| self.vf = np.vectorize(func) | |
| def draw(self, x_start=-5.0, y_end=5.0): | |
| x = np.arange(x_start, y_end, 0.1) |
https://qiuri.org/806.html https://www.rawidn.com/posts/how-to-use-dns-tunnel.html https://github.com/yarrick/iodine#server-side
iodined -f -p 5353 -P password 192.168.100.1 t1.yingshaoxo.xyz