Skip to content

Instantly share code, notes, and snippets.

Peter Wu Lekensteyn

Block or report user

Report or block Lekensteyn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Lekensteyn /
Last active May 17, 2020
Extracts a subset of TLS secrets and injects them in an existing capture file (requires Wireshark 3.0).
#!/usr/bin/env python3
# Extracts a subset of TLS secrets and injects them in an existing capture file.
# Author: Peter Wu <>
import argparse
import os
import shlex
import subprocess
import sys
Lekensteyn /
Created Sep 5, 2017
Extracts commits from the src/crypto/tls/ directory (from Go upstream) in a reproducible way, preserving all metadata (including committer info).
# Extracts commits from the src/crypto/tls/ directory (from Go upstream) in a
# reproducible way, preserving all metadata (including committer info).
# Strategy:
# 0. Create a new temporary working repo.
# 1. Fetch go branch/commit that should be pulled from.
# 2. Rewrite history of go branch, extracting just the src/crypto/tls/ commits.
# 3. Push the updated branch back to tls-tris.
Lekensteyn / nvml-debugdump.c
Last active Jul 13, 2018
Make (nvidia-smi) write plaintext debug logs (mirror of
View nvml-debugdump.c
* Make (nvidia-smi) write plaintext debug logs.
* Usage:
* gcc -shared -fPIC -ldl nvml-debugdump.c -o
* LD_PRELOAD=./ nvidia-smi --debug=debug.log -q
* For other NVML applications, set env var __NVML_DBG_FILE=debug.log
Lekensteyn / wireshark-postdissector.lua
Created Oct 25, 2016
Wireshark post-dissector example (tested with Wireshark 2.0.6 and git master (2.3.x))
View wireshark-postdissector.lua
-- Wireshark post-dissector written in Lua
-- "Turns out #wireshark allows adding any field value as a column.
-- How about a column with a function of a value like strlen(x)+5 or log(x)?😁"
-- You were asking for what? Ok, here you go! An example of a Lua
-- post-dissector which adds a field to the Wireshark protocol tree which can
-- then be displayed as custom column. Have fun! ~ @Lekensteyn
Lekensteyn / 0001-Enable-more-optional-dependencies.patch
Last active Mar 29, 2016
gammaray 2.4.1-2 packaging patch and build log
View 0001-Enable-more-optional-dependencies.patch
From 71fb48669d8508c4571bd9ca4b603ba83d0aa6a8 Mon Sep 17 00:00:00 2001
From: Peter Wu <>
Date: Tue, 29 Mar 2016 10:41:39 +0200
Subject: [PATCH] Enable more optional dependencies
Also add cmake as makedepends and perl for building manual pages.
Explicitly use CMAKE_BUILD_TYPE=Release to avoid building in debug mode.
Set ECM_MKSPECS_INSTALL_DIR as suggested on to avoid
Lekensteyn / libev-4.22-cmake.patch
Created Mar 18, 2016
hacky cmake patch for libev-4.22 (for use with MSVC 2013
View libev-4.22-cmake.patch
diff -Nur libev-4.22.orig/ libev-4.22/
--- libev-4.22.orig/ 1970-01-01 01:00:00.000000000 +0100
+++ libev-4.22/ 2016-03-18 01:18:55.167666371 +0100
@@ -0,0 +1 @@
+/* Dummy file */
diff -Nur libev-4.22.orig/CMakeLists.txt libev-4.22/CMakeLists.txt
--- libev-4.22.orig/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
+++ libev-4.22/CMakeLists.txt 2016-03-18 01:17:27.359666381 +0100
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.0)
Lekensteyn /
Created Dec 29, 2015
Quick and dirty script to parse aboot images
#!/usr/bin/env python
# From target/msm8974/tools/mkheader.c (size renamed to size)
magic[0] = 0x00000005; /* appsbl */
magic[1] = 0x00000003; //Flash_partition_version /* nand */
magic[2] = 0x00000000; //image source pointer
magic[3] = base; //image destination pointer
magic[4] = code_size + cert_chain_size + signature_size; //image size
Lekensteyn /
Last active Oct 27, 2019 — forked from pudquick/
Pure python reimplementation of .cpio.xz content extraction from pbzx file payload for OS X packages
#!/usr/bin/env python
# Extract .cpio file from a pbzx Payload file.
# Based on,
# this version adds a command-line interface, improves efficiency (1 MiB chunks
# instead of a full copy in memory), adds Python 3 compatibility and
# automatically decompresses stuff (some blocks may not be compressed).
# Example usage (from Python):
Lekensteyn /
Created Aug 16, 2015
Script to patch an Android recovery.img file, changing the qcom,qpnp-rtc-write Device Tree property (tested with an Android 5.1 image based on kernel 3.4 for a Nexus 5 (rev_11)).
#!/usr/bin/env python
Patch a recovery image to enable RTC writing
Unfortunately it has not the intended effect (tested from recovery):
~ # /system/xbin/hwclock -w
hwclock: RTC_SET_TIME: Operation not permitted
<3>[ 25.821247] spmi_pmic_arb fc4cf000.qcom,spmi: pmic_arb_wait_for_done: transaction denied (0x5)
<3>[ 25.821338] qcom,qpnp-rtc qpnp-rtc-ee162000: SPMI write failed
Lekensteyn / dependencies.txt
Last active Aug 29, 2015
Library dependencies based on the contents of the factory images for hammerhead 5.1.1 (LMY48B)
View dependencies.txt
You can’t perform that action at this time.