Skip to content

Instantly share code, notes, and snippets.

View PEMessage's full-sized avatar
🇨🇳

PEMessage

🇨🇳
View GitHub Profile
@PEMessage
PEMessage / kernel-arm64.md
Created May 13, 2024 17:11 — forked from MaskRay/kernel-arm64.md
Linux kernel's arm64 port

In the kernel source directory, run

make O=/tmp/linux/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j60 defconfig all

Then create an Alpine aarch64 image following https://hackmd.io/@starnight/Run_Alpine_on_QEMU_aarch64_Virtual_Machine

wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/aarch64/netboot/vmlinuz-lts https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/aarch64/netboot/config-lts
@PEMessage
PEMessage / backtrace.cpp
Created January 16, 2025 03:00 — forked from xiaozhuai/backtrace.cpp
Android native c++ get back trace (stacktrace)
#include <tinyformat.h>
#include <unwind.h>
#include <cxxabi.h>
#include <dlfcn.h>
struct android_backtrace_state {
void **current;
void **end;
};
@PEMessage
PEMessage / backtrace.cpp
Created January 16, 2025 03:00 — forked from xiaozhuai/backtrace.cpp
Android native c++ get back trace (stacktrace)
#include <tinyformat.h>
#include <unwind.h>
#include <cxxabi.h>
#include <dlfcn.h>
struct android_backtrace_state {
void **current;
void **end;
};
@PEMessage
PEMessage / dump-type.py
Created June 3, 2025 03:09 — forked from jimblandy/dump-type.py
GDB Python script to define a command for inspecting types.
# Put this in a file BLAH/dump-type.py and then put this in your ~/.gdbinit file
# (or type it at the GDB prompt):
#
# source BLAH/dump-type.py
#
# Then you can say:
#
# (gdb) help jimb-dump-type
#
# and you should get a help message.
@PEMessage
PEMessage / gdb-trace.py
Created June 11, 2025 01:50 — forked from quark-zju/gdb-trace.py
Trace all function calls using gdb
#!/usr/bin/env python
try:
import gdb
inside_gdb = True
except ImportError:
inside_gdb = False
if inside_gdb:
@PEMessage
PEMessage / build-static-ag.sh
Created June 12, 2025 16:49
build-static-ag.sh
#!/bin/sh
# Credit: https://www.gkbrk.com/static-zstd-binary
docker run -t \
-e UID="$(id -u)" \
-e GID="$(id -g)" \
-v "$PWD":/w \
-w /tmp \
--rm \
-it \
alpine:3.18 \
@PEMessage
PEMessage / build-static-ast-grep.sh
Created June 12, 2025 16:51
build-static-ast-grep.sh
#!/bin/sh
# Credit: https://gist.github.com/Saoneth/02f08d4714e6fc035e7017c74b3ef29a
docker run -t \
-e UID="$(id -u)" \
-e GID="$(id -g)" \
-v "$PWD":/w \
-w /tmp \
--rm \
alpine \
sh -c "
@PEMessage
PEMessage / build-static-vmtouch.sh
Created June 12, 2025 16:52
build-static-vmtouch.sh
#!/bin/sh
# Credit: https://gist.github.com/Saoneth/02f08d4714e6fc035e7017c74b3ef29a
docker run -t \
-e UID="$(id -u)" \
-e GID="$(id -g)" \
-v "$PWD":/w \
-w /tmp \
--rm \
alpine \
sh -c '
@PEMessage
PEMessage / build-static-uchardet.sh
Created June 12, 2025 16:53
build-static-uchardet.sh
#!/bin/sh
docker build -t chardet-builder - <<EOF
# Dockerfile with caching optimizations
FROM alpine:3.18 AS builder
# Install dependencies in a single layer for caching
RUN apk add \
musl-dev git make
RUN apk add \