Skip to content

Instantly share code, notes, and snippets.

Converting .a to .so

Use the .o files inside the .a archive to create a .so

  1. Extract the .a archive:

    ar x libsomething.a

netns ipvlan L3 NAT

This Bash script sets up and tears down a network namespace using ipvlan (L3 mode) and NAT on a Linux system.

It has two main commands:

setup

  • Creates a new network namespace (a separate network environment).
  • Adds two ipvlan interfaces (host side and namespace side).

iOS Rain Notifier

End-to-End Workflow for Exporting a Public iOS Shortcut as JSON


1. Publish the Shortcut

  1. Open Shortcuts .app → long-press the shortcut → ShareCopy iCloud Link. Example link:

Binding Functions with Frida Gum (x86 / x86-64)

Purpose Generate at run-time a zero-argument function that always calls a given 2-argument function with two fixed constants, using Frida Gum’s GumX86Writer.

Build (Linux example)

g++ bound_function.cpp -o bound -I./frida -L./frida -lfrida-gum

Frida Gum Function Hook Example

The program demonstrates how to intercept (“hook”) a C function at runtime with Frida Gum. install_hook() replaces the original func() with my_func(), while keeping a pointer (orig_func) so the genuine implementation can still be called. After the test call, remove_hook() cleans everything up and de-initialises Frida.

Build

We need frida-gum-devkit. Please access frida/releases.

WebGPU compute shader examples

Purpose

Demonstrates how to perform GPU compute shader in the browser using the WebGPU API.

How to run

  1. Prerequisites: A recent Chromium-based browser (Chrome ≥ 113, Edge, etc.) with the “WebGPU” feature enabled.
  2. Launch: Prepare an https web server to serve the html. open html via a web server. The protocol should be https://.

WebRTC DataChannel Tester with QR Exchange

Purpose To establish a peer-to-peer WebRTC DataChannel between two browsers without a signalling server by exchanging the session description (SDP) through on-screen QR codes.

How to Use

  1. Select a role – One user selects Offerer, the other Answerer.
  2. Generate your SDP

iOS tall screenshot PDF to multi-page PDF

This Python 3 script, built with the pypdf library, converts a single extremely tall PDF—such as one created by an iOS browser’s full-page screenshot feature—into a multi-page document:

  • Aspect-ratio slicing It cuts the original page into consecutive slices that keep the same aspect ratio as A4 paper (≈ 1 : √2), regardless of the actual width.
  • Overlap control Each new page starts slightly higher than the previous slice end, leaving a configurable overlap (e.g., 10 mm) so content isn’t split awkwardly.
  • Fully offline Everything happens locally; no external services or GUI frameworks are required.
  • Customisable You can change the overlap size, shrink or crop the width if it exceeds A4, and wrap the logic in a CLI or GUI if needed.

How to Route Only Specific Address Ranges Through VPN Using openfortivpn

Purpose: This guide explains how to configure routing so that only necessary IP address ranges go through the VPN interface (ppp0), while the default internet traffic uses the regular network interface (eth0). This avoids routing all traffic through the VPN and limits VPN usage to required subnets.

Steps:

  1. Change the default route to go through the main network interface (eth0) instead of the VPN interface (ppp0):