This file contains 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
#include <Windows.h> | |
#include <memory.h> | |
#include <stdlib.h> | |
#include <winnt.h> | |
int main(void) { | |
MessageBoxA(NULL, "Hello world!", "MSGBOX", MB_OK); | |
return 0; | |
} |
This file contains 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
; author: weak_ptr <weak_ptr@outlook.com> | |
; date: 2021-10-11 17:01 | |
; description: PE from scratch with nasm assembler | |
; | |
; reference: http://www.phreedom.org/research/tinype/ | |
; | |
; compile command: nasm -f bin tinype.asm -o tinype.exe | |
; | |
BITS 32 |
This file contains 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 sys | |
import subprocess | |
import logging | |
# ! 工具函数 | |
# ---------------------------------------------------------------------------- | |
def require(package, import_name=None, editable=False, quiet=True, index='https://pypi.org/simple'): | |
logger = logging.getLogger('require') | |
try: | |
from pip import main |
This file contains 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 flask_sqlalchemy import SQLAlchemy | |
def list_models(db: SQLAlchemy): | |
classes, models, table_names = [], [], [] | |
for clazz in db.Model._decl_class_registry.values(): | |
if getattr(clazz, '__tablename__', None): | |
table_names.append(clazz.__tablename__) | |
classes.append(clazz) | |
for table in db.metadata.tables.items(): |
This file contains 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
# compatibility: python 3.6+ | |
import types | |
import typing | |
from importlib import import_module | |
from pkgutil import walk_packages | |
def import_recursive(pkg: typing.Type[types.ModuleType]) -> typing.Sequence[typing.Type[types.ModuleType]]: | |
""" | |
递归导入指定包下所有模块 |
This file contains 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
export enum Keycode { | |
None = -1, | |
// none = 0,1,2,3,4,5,6,7 | |
BackSpace = 8, | |
Tab = 9, | |
// none = 10,11,12 | |
Enter = 13, | |
// none = 14,15 | |
Shift = 16, | |
Ctrl = 17, |