Skip to content

Instantly share code, notes, and snippets.

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):

Generate slimmed down WSL ubuntu image

example for ifuse

Safe Package Removal Script with Protection Check

Purpose

This script automates the removal of packages listed in one file (to_be_removed.txt), but skips removal if doing so would also remove any "protected" packages listed in another file (keep.txt). It ensures important packages are not accidentally uninstalled.

Usage

  1. Prepare two text files:

Auto-Sort Downloads by Creation Month

Purpose

To automatically organize all files and folders in the Downloads directory into subfolders named by their creation year and month (format: YYYYMM).

Method

  • The script scans all items in the ~/Downloads folder.
  • If an item is not already in a correctly named folder for the current or past month, it is moved.