tampermonkey验证码识别

首先安装tesseract。 参考: Installation tessdoc/Home 编译安装方法 参考:Compiling-GitInstallation 通过pip安装pytesseract 后台: #!/usr/bin/env python # ocr backend import asyncio import websockets import base64 from io import BytesIO from PIL import Image import pytesseract async def get_ocr(websocket, _): while True: # base64 encoded img file data = await websocket.recv() seq = 'base64,' pos = data.find(seq) + len(seq) x = base64.b64decode(data[pos:]) # img file img = Image.open(BytesIO(x)) # result a = pytesseract.image_to_string(img) out = a.strip().replace(" ", "") print(out) await websocket.send(out) start_server = websockets.serve(get_ocr, "127.0.0.1", 5678) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() 参考: ...

April 24, 2021

ctrl+z导致powershell中docker命令行意外退出

最近经常使用 pwsh(PowerShell Core)连接 docker 访问 PostgreSQL 数据库,当我编辑命令的时候,可以使用 Ctrl+左右方向键进行左右词间的跳转,或者使用 alt+backspace 进行以词为单位的删除。 I frequently use pwsh to access docker-based postgresql database recently. It supports Ctrl+left/right edit on the command line. Use alt+backspace can delete words. 然而,当我多删了一个词的时候,长时间使用文本编辑器的习惯使我按下了 ctrl+z,希望进行恢复。这时,意外发生了:docker 命令行退出,返回到了 pwsh prompt。 But, When I acceidently press more backspace, I want to use “ctrl+z” to recover. An incident happens: docker command exited! 我尝试进行了一些搜索: I tried some searches: ctrl+z terminate docker terminal suspend and recover in powershell docker windows “ctrl z” 得到了一些相关的内容: ...

November 19, 2020

psql常用命令

命令 Command 作用 Action \h [NAME] help on syntax of SQL commands, * for all commands \d[S+] list tables, views, and sequences \d[S+] NAME describe table, view, sequence, or index \l[+] [PATTERN] list databases \echo [-n] [STRING] write string to standard output (-n for no newline) \i FILE execute commands from file \cd [DIR] change the current working directory \c[onnect] connect to new database \conninfo display information about current connection \q quit psql

November 15, 2020