Skip to content

Instantly share code, notes, and snippets.

View singleghost2's full-sized avatar
🎯
Focusing

Stack Master singleghost2

🎯
Focusing
View GitHub Profile
@singleghost2
singleghost2 / custom_logger.py
Created July 10, 2024 07:50
A beautiful custom logger
import logging
import time
from colorama import init, Fore, Style
init(autoreset=True) # 初始化colorama并设置自动重置
# 创建一个自定义的日志记录格式,包括颜色设置和时间格式
class CustomFormatter(logging.Formatter):
format_dict = {
logging.DEBUG: Fore.CYAN + "[%(custom_time)s] %(levelname)s: %(message)s" + Style.RESET_ALL,
@singleghost2
singleghost2 / load_wrapper.cc
Created November 21, 2023 03:09
Disable ASLR on macOS for dylib include those loaded with `dlopen`
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <spawn.h>
#include <sys/wait.h>
#include <string.h>
/* ASLR disabling magic constant from Apple LLDB source code
https://opensource.apple.com/source/lldb/lldb-76/tools/darwin-debug/darwin-debug.cpp
*/