Skip to content

Instantly share code, notes, and snippets.

@synodriver
Created November 12, 2022 15:48
Show Gist options
  • Save synodriver/5e6d80ede7cd1eaa09ed5cfe21229661 to your computer and use it in GitHub Desktop.
Save synodriver/5e6d80ede7cd1eaa09ed5cfe21229661 to your computer and use it in GitHub Desktop.
import re
from matplotlib import pyplot as plt
from PIL import Image,ImageColor, ImageDraw, ImageFont
import numpy as np
import zhconv
text = """A140   , 、 。 . ‧ ; : ? ! ︰ … ‥ ﹐ ﹑ ﹒
A150 · ﹔ ﹕ ﹖ ﹗ | – ︱ — ︳ ╴ ︴ ﹏ ( ) ︵
A160 ︶ { } ︷ ︸ 〔 〕 ︹ ︺ 【 】 ︻ ︼ 《 》 ︽
A170 ︾ 〈 〉 ︿ ﹀ 「 」 ﹁ ﹂ 『 』 ﹃ ﹄ ﹙ ﹚
A1A0 ﹛ ﹜ ﹝ ﹞ ‘ ’ “ ” 〝 〞 ‵ ′ # & *
A1B0 ※ § 〃 ○ ● △ ▲ ◎ ☆ ★ ◇ ◆ □ ■ ▽ ▼
A1C0 ㊣ ℅ ¯  ̄ _ ˍ ﹉ ﹊ ﹍ ﹎ ﹋ ﹌ ﹟ ﹠ ﹡ +
A1D0 - × ÷ ± √ < > = ≦ ≧ ≠ ∞ ≒ ≡ ﹢ ﹣
A1E0 ﹤ ﹥ ﹦ ~ ∩ ∪ ⊥ ∠ ∟ ⊿ ㏒ ㏑ ∫ ∮ ∵ ∴
A1F0 ♀ ♂ ⊕ ⊙ ↑ ↓ ← → ↖ ↗ ↙ ↘ ∥ ∣ / """
text = re.sub(r"[A-Z]\d[0-9A-F]0", "", text)
text = zhconv.convert(text, "zh-hans")
print(text)
import ctypes
from ctypes.wintypes import LPDWORD, DWORD
kernel32 = ctypes.windll.kernel32
GetConsoleProcessList = kernel32.GetConsoleProcessList
GetConsoleProcessList.argtypes = [LPDWORD, DWORD]
GetConsoleProcessList.restype = DWORD
ids_t = DWORD*5
ids = ids_t()
GetConsoleProcessList(ids, 5)
im = Image.new('RGB', (200, 200), color="black")
draw = ImageDraw.Draw(im)
font = ImageFont.truetype(font='simsun.ttc', size=8)
draw.text(xy=(10, 10), text=text, fill=(255, 255, 255), font=font)
plt.imshow(np.asarray(im))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment