Skip to content

Instantly share code, notes, and snippets.

@PEMessage
PEMessage / bash
Created January 27, 2026 03:04
Run ptghci in Ubuntu 24.04LTS
#!/bin/bash
# sudo apt-get install libzmq3-dev pkg-config
if [ ! -d .venv ] ; then
uv venv --python 3.8
source .venv/bin/activate
pip install pybits/requirements.txt
fi
source .venv/bin/activate
// $ cc -o checker checker.c
// $ ./checker
// $ ffmpeg -i output-%02d.ppm -r 60 output.mp4
#include <stdio.h>
int main()
{
char buf[256];
for (int i = 0; i < 60; ++i) {
snprintf(buf, sizeof(buf), "output-%02d.ppm", i);
@PEMessage
PEMessage / build-ubuntu1804-tree-sitter-cli
Created December 10, 2025 03:12
A script to build ubuntu1804-tree-sitter-cli for neovim treesitter main branch
#!/bin/sh
docker build -t tree-sitter-builder - <<EOF
# Dockerfile with caching optimizations for tree-sitter CLI
FROM ubuntu:18.04 AS builder
# RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
# RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
# Install dependencies in a single layer for caching
Cheef's Grand APDU List Smartcard Selected Information APDU list
Reference: http://web.archive.org/web/20090630004017/http://cheef.ru/docs/HowTo/APDU.info
#------------+------------------------+------------------------+----------------------+--------------------------------+
|ClaIns P1 P2|Lc Send Data |Le Recv Data | Specification | Description |
+------------+------------------------+------------------------+----------------------+--------------------------------+
| 04 | ISO 7816-9 6.3 | DEACTIVATE FILE |
| A0 04 00 00 00 | 3GPP TS 11.11 | INVALIDATE |
| A0 04 00 00 00 | SAGEM SCT U34 6.15 | INVALIDATE |
+------------+------------------------+------------------------+----------------------+--------------------------------+
@PEMessage
PEMessage / android-cli-build.md
Created July 8, 2025 01:13 — forked from stkptr/android-cli-build.md
Guide for getting a command line buildsystem for Android apps set up

Developing Android apps without Android Studio (Debian 12)

If you're looking to develop an Android app you might be led to Android Studio. It's the IDE recommended and developed by Google for the express purpose of Android development. It does what it needs to, but if you look at the system requirements you will see some alarming numbers. If you're using an older system, or simply don't want to use AndroidStudio, this is the guide for you.

Installing packages

We won't be using many apt packages due to permissions issues and incompatible versions. That being said:

$ sudo apt install openjdk-17-jdk sdkmanager kotlin
@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 \
@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-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-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 / 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: