Skip to content

Instantly share code, notes, and snippets.

@aFewThings
aFewThings / MatToNDArrayConverter.cpp
Created August 15, 2019 14:21
How to Convert Mat object to NDArray object using Boost Python, Numpy, OpenCV.
/*
* This example code is made for describe how to convert OpenCV's Mat class to Boost Numpy's ndarray class and vice versa.
* As far as I know, there was some library or boilerplate code about converting Mat to ndarray. But to me those methods were too expensive and difficult to understand.
* Recently, I have found that Boost Python has Numpy extension and it gives ndarray class properly.
* No other modules are used for conversion, only Boost Python, Boost Numpy, and OpenCV. (Version : Windows7, Python3.5, BoostPython 1.68, OpenCV 4.0.0)
* This code is designed to show you a specific case like converting 'CV_8UC3' type Mat image to 'uint8' dtype ndarray. And it contains a minimum of code to explain.
* I hope you get the idea of converting ndarray to fit your case properly through this example.
*/
#define BOOST_PYTHON_STATIC_LIB
@xaliphostes
xaliphostes / README.md
Last active February 7, 2024 08:53
Emscripten pthread lib in web worker

A small multi-threaded C++ library (so, does not include any main) compiled with emscripten and pthread running under the main thread in the browser, a web worker or using node.js.

Note: Emscripten will produce lib.js.

Using a web browser

Running this lib in the main thread is fine but, obviously, block the main thread. Running it using a web worker leads no error with modification of the worker script (see below)

Using node.js

Run fine except that it prevents Node app from ever exiting.

@xdavidhu
xdavidhu / wokplace-ssl-pinning-bypass.md
Last active April 26, 2025 16:53
Bypassing SSL Pinning in Facebook/Meta Workplace (Android)

Tested on Workplace for Android version 362.0.0.29.109. This approach might work in other Facebook/Meta applications. Thank you Imre Rad for helping me analyze the binary.

How does it work?

The Workplace Android app uses the Fizz open source TLS-1.3 library to communicate with the backend APIs. This library is written in C++, and is compiled to native code. It is running as a native library attached to the Android app.

The certificate verification is implemented in fizz/client/ClientProtocol.cpp, on line 1944. The easiest way to bypass this check is to patch the if (state.verifier()) { check on line 1942.

@thesamesam
thesamesam / xz-backdoor.md
Last active April 29, 2025 14:00
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Update: I've disabled comments as of 2025-01-26 to avoid everyone having notifications for something a year on if someone wants to suggest a correction. Folks are free to email to suggest corrections still, of course.

Background