This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import glob from "glob"; | |
| import {readFile, writeFile} from 'fs'; | |
| import {optimize, OptimizedSvg} from "svgo"; | |
| glob("**/*.html", (err, files) => { | |
| if (err) throw err; | |
| files.forEach(file => { | |
| readFile(file, 'utf8', (err, content) => { | |
| if (err) throw err; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """See https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2124-0-201901-I!!PDF-E.pdf.""" | |
| import numpy as np | |
| import numpy.typing as npt | |
| _bgr2lms_matrix = ( | |
| np.array( | |
| [ | |
| [262, 462, 3688], | |
| [2146, 2951, 309], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from collections import defaultdict | |
| # read data.json | |
| data = json.load(open("data.json")) | |
| d = defaultdict(dict) | |
| for col in data: | |
| col: dict | |
| n = col["Column1"] | |
| for k in col.keys(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createLogger, format, transports } from "winston"; | |
| const logger = createLogger({ | |
| level: "debug", | |
| transports: [ | |
| new transports.Console({ | |
| format: format.combine(format.colorize(), format.simple()), | |
| }), | |
| new transports.File({ | |
| filename: "discord-embeds-reader-bot.log", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| def convert(s: str) -> str: | |
| start = re.search(r"/\* (.*) \*/\s*", s).group(1).replace("( ", "(") | |
| s = re.search(r"T0_init.*;", s, re.S).group(0) | |
| s = re.sub(r"/\*.*\*/\s*", "", s) | |
| s = s.replace("init", "S1").replace("&&", "&").replace("(", "").replace(")", "") | |
| s = re.sub(r"\s*(if|fi;)", "", s) | |
| s = re.sub(r"T\d+_S(\d+)", r"\1", s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from itertools import product | |
| import pytest | |
| from automata.tm.configuration import TMConfiguration | |
| from automata.tm.dtm import DTM | |
| from automata.tm.tape import TMTape | |
| tm = DTM( | |
| states={f"q{i}" for i in range(7)}, | |
| input_symbols=set("01"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| from itertools import product | |
| from random import sample | |
| import pytest | |
| from automata.fa.dfa import DFA | |
| dfa = DFA( | |
| states=set("pqrs"), | |
| input_symbols=set("01"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import keyboard | |
| import pydirectinput as pyautogui | |
| pyautogui.PAUSE = 0 | |
| def f(): | |
| while not keyboard.is_pressed("0"): | |
| pyautogui.press("up") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fixnat { | |
| net stop winnat | |
| net start winnat | |
| } | |
| function proxy { | |
| $Env:http_proxy="http://127.0.0.1:7890";$Env:https_proxy="http://127.0.0.1:7890" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var delimiter = "<br>" | |
| var weekCycle = []; | |
| weekCycle[1] = "";// "%u8FDE"; | |
| weekCycle[2] = "%u5355"; | |
| weekCycle[3] = "%u53CC"; | |
| var result = new String(""); | |
| var weeksPerYear = 53; | |
| // 输出教学活动信息 | |
| function activityInfo() { | |
| return "teacherId:" + this.teacherId + "\n" |
NewerOlder