From 59f8915eb9f848bf0ad4324516fe5fb17a608cf7 Mon Sep 17 00:00:00 2001 From: acevest Date: Tue, 24 Aug 2021 10:00:00 +0800 Subject: [PATCH] ... --- tools/comm/aut.py | 41 ++++++++++++++++++++++++++++++ tools/mcu/DigitStrCompress/go.mod | 3 +++ tools/mcu/DigitStrCompress/main.go | 36 ++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100755 tools/comm/aut.py create mode 100644 tools/mcu/DigitStrCompress/go.mod create mode 100644 tools/mcu/DigitStrCompress/main.go diff --git a/tools/comm/aut.py b/tools/comm/aut.py new file mode 100755 index 0000000..e1dd8c0 --- /dev/null +++ b/tools/comm/aut.py @@ -0,0 +1,41 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------ +# File Name: aut.py +# Author: Zhao Yanbai +# 2021-08-20 10:56:36 Friday CST +# Description: none +# ------------------------------------------------------------------------ + +import argparse +import socket +import sys + + +def UDPServer(addr) : + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.bind(addr) + while True : + data = s.recv(1024) + sys.stdout.write(data.decode(sys.stdout.encoding)) + sys.stdout.flush() + + + +def main() : + parser = argparse.ArgumentParser(prog='aut', description='AceVest UDP Tool', epilog='') + parser.add_argument('host', help='hostname or host ip') + parser.add_argument('port', type=int, help='port') + parser.add_argument('-l', '--listen', action='store_true', help='Bind and listen for incoming connections') + parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.2') + arg = parser.parse_args() + + addr = (arg.host, arg.port) + if arg.listen : + UDPServer(addr) + else : + UDPClient(addr) + + +if __name__ == "__main__" : + main() diff --git a/tools/mcu/DigitStrCompress/go.mod b/tools/mcu/DigitStrCompress/go.mod new file mode 100644 index 0000000..3897864 --- /dev/null +++ b/tools/mcu/DigitStrCompress/go.mod @@ -0,0 +1,3 @@ +module DigitalStringCompress + +go 1.14 diff --git a/tools/mcu/DigitStrCompress/main.go b/tools/mcu/DigitStrCompress/main.go new file mode 100644 index 0000000..1d3201d --- /dev/null +++ b/tools/mcu/DigitStrCompress/main.go @@ -0,0 +1,36 @@ +/* + * ------------------------------------------------------------------------ + * File Name: main.go + * Author: Zhao Yanbai + * 2021-04-28 17:27:01 Wednesday CST + * Description: none + * ------------------------------------------------------------------------ + */ + +package main + +import ( + "fmt" + "math/big" +) + +const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + +func DigitalStringCompress(ds string) string { + var cs string + + n := big.NewInt(0) + + base := big.NewInt(10) + for c := range ds { + n.Mul(n, base) + n.Add(n, uint64(c)) + } + + return "s" +} + +func main() { + defer fmt.Println("Program Exited...") + +} -- 2.44.0