Skip to content

Instantly share code, notes, and snippets.

View asukaminato0721's full-sized avatar
💭
I may be slow to respond.

Asuka Minato asukaminato0721

💭
I may be slow to respond.
View GitHub Profile
from __future__ import annotations
from dataclasses import dataclass
from typing import Callable, List
from operator import attrgetter, add, sub, mul, truediv
def adder(a: Connector, b: Connector, c: Connector):
return TernaryConstraint(a, b, c, add, sub, sub)
@asukaminato0721
asukaminato0721 / Seven-segment display.py
Created October 5, 2022 09:08
good data structure + simple algorithm.
num2str = {
k: v.split("\n")[1:]
for k, v in {
1: """
|
|""",
2: """
_
_|
@asukaminato0721
asukaminato0721 / eigen_style_mat.py
Created September 25, 2022 14:18
a simple mat class which mimic the behavior of Eigen.
from dataclasses import dataclass
from typing import Any, Optional, Sequence
@dataclass
class Mat:
row: int
col: int
data: Optional[Sequence[Sequence[Any]]] = None
@asukaminato0721
asukaminato0721 / iostream.py
Created July 15, 2022 19:18
make iostream in python
class _cout:
def __lshift__(self, x):
print(x, end="")
return self
class _cin:
def __rshift__(self, x):
globals()[x] = input()
return self
@asukaminato0721
asukaminato0721 / S007: データヒストグラム.py
Last active June 11, 2022 14:31
paiza S007: データヒストグラム
'''
cut token, then use ast to traverse.
paiza
S007: データヒストグラム
'''
from collections import defaultdict
from dataclasses import dataclass
from functools import reduce
@asukaminato0721
asukaminato0721 / GalGame_auto_ocr.py
Last active March 7, 2022 09:34
needs improve for deal with picture.
#!/usr/bin/env python3
# use pillow https://pillow.readthedocs.io/en/latest/reference/ImageGrab.html to copy a place of screen, get pillow object
# use tesseract to transform a picture into text
# use TextBlob to translate text
# use google translate to translate text
from time import sleep
from typing import Tuple
@asukaminato0721
asukaminato0721 / life_is_short.py
Created January 19, 2022 17:59
A script to remind how time flies.
#!/usr/bin/env python3
from calendar import isleap
from datetime import datetime
from subprocess import Popen
NOW = datetime.now()
YEAR = NOW.year
FIRST_DAY = datetime(YEAR, 1, 1)
DAY_DIFF = (NOW - FIRST_DAY).days + 1
DAY_COUNT = 366 if isleap(YEAR) else 365
@asukaminato0721
asukaminato0721 / cookies.json
Created January 15, 2022 06:24
QuillBot premium for free. Open Quillbot website Delete cookies Copy Quillbot cookies from the link given below Paste cookies and click on import button. Now here is the tricky part: When you import cookies then refresh your browser. After 3 seconds, you will see “PREMIUM” something similar to below picture When “PREMIUM” appears then suddenly p…
[
{
"domain": ".quillbot.com",
"expirationDate": 1673083346,
"hostOnly": false,
"httpOnly": false,
"name": "_uetvid",
"path": "/",
"sameSite": null,
"secure": false,
@asukaminato0721
asukaminato0721 / galgame_in_wine.md
Last active February 18, 2022 16:16
Notes on play Galgame on wine 笔记: 如何在 wine 上打 Galgame
  1. choose good tools.
    1. crossover 关于无限 15 天试用期, 把容器里的 .eval 文件删除就重新计时了.
    2. playonlinux
    3. winetricks
    4. bare wine
  2. 函数库
    1. 原装先于内建
      1. d3dx11_43
      2. d3x9_43
  3. dsound
@asukaminato0721
asukaminato0721 / Thread-end.py
Last active January 8, 2022 20:54
Clojure's -> and ->> operator in python
"""
This mimic the behavior of clojure's Thread-end ->>
"""
from functools import reduce, wraps
from typing import Callable
def double_rightarrow_decorator(f: Callable):