Skip to content

Instantly share code, notes, and snippets.

@sandin
sandin / UnityNativeCrashHandlerPatch.java
Last active April 25, 2021 04:42
native crash handler patch for unity 2019
package com.unity3d.player;
import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public final class UnityNativeCrashHandlerPatch {
public static void setupNativeCrashHandler() {
try {
@wonderbeyond
wonderbeyond / set-apt-proxy.md
Last active May 6, 2024 09:11
[ubuntu][socks5][proxy] Set proxy for apt

Writing an apt proxy conf file /etc/apt/apt.conf.d/proxy.conf as below.

Acquire::http::Proxy "socks5h://127.0.0.1:1080";
Acquire::https::Proxy "socks5h://127.0.0.1:1080";
Acquire::socks::Proxy "socks5h://127.0.0.1:1080";

And the proxy settings will be applied the next time we run apt.

@PollyP
PollyP / intel_pintools_vs2019.md
Last active December 19, 2023 14:52
Building and Running Intel Pintools with VS 2019 on Windows 10
@stecman
stecman / dump-pyc-with-gdb.md
Last active March 25, 2024 09:20
Dumping all bytecode from a packaged Python application

This is a technique for extracting all imported modules from a packaged Python application as .pyc files, then decompiling them. The target program needs to be run from scratch, but no debugging symbols are necessary (assuming an unmodified build of Python is being used).

This was originally performed on 64-bit Linux with a Python 3.6 target. The Python scripts have since been updated to handle pyc files for Python 2.7 - 3.9.

Theory

In Python we can leverage the fact that any module import involving a .py* file will eventually arrive as ready-to-execute Python code object at this function:

PyObject* PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals);
@JimmyAppelt
JimmyAppelt / disableWinRestartOnUpdate.md
Last active February 18, 2024 17:48
Disable Automatic Restarts in Windows 10 Home Anniversary Update

Win 10 Pro:

  • Press win+R then type gpedit.msc and press enter
  • This will open the group policy editor. Browse through the 'tree' to the following entry: Computer Configuration > Administrative Templates > Windows Components > Windows Update.
  • Look on the right panel and search for the option named No auto-restart with logged on users for scheduled automatic updates installations.
  • Double-click on it, then change the radio button in the popup window that will appear from not configured to enabled and click OK.
  • To make the system immediately apply the changes you just made, press win+R again and issue the gpupdate /force command

Win 10 Pro (alternative method) and Home:

@arteymix
arteymix / git-archive-all
Last active March 15, 2024 10:55
Archive HEAD and its submodules recursively
#!/usr/bin/env sh
if [ -z $1 ]; then
echo "You must specify a super-archive name."
exit 1
fi
git archive --prefix "$1/" -o "$1.tar" HEAD
git submodule foreach --recursive "git archive --prefix=$1/\$path/ --output=\$sha1.tar HEAD && tar --concatenate --file=$(pwd)/$1.tar \$sha1.tar && rm \$sha1.tar"

Light Introduction to Android Platform Graphics Internals

This introduction describes the key functionalities of platform graphics components. It is only to give an overview. Always read the source code.

libhardware

The source code of libhardware is located at hardware/libhardware. It

@wenchy
wenchy / Makefile
Last active January 16, 2024 15:36
Compile all .cpp files into one target under the current directory.
CC := g++
CFLAGS := -Wall -g
TARGET := test
# $(wildcard *.cpp /xxx/xxx/*.cpp): get all .cpp files from the current directory and dir "/xxx/xxx/"
SRCS := $(wildcard *.cpp)
# $(patsubst %.cpp,%.o,$(SRCS)): substitute all ".cpp" file name strings to ".o" file name strings
OBJS := $(patsubst %.cpp,%.o,$(SRCS))
all: $(TARGET)
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@dannvix
dannvix / nginx-non-transparent-ssl-proxy.md
Last active October 16, 2023 19:07
Guide to set up nginx as non-transparent SSL proxy, which subsitutes strings in the server responses

Use nginx as Non-Transparent SSL Proxy

Introduction

Many mobile apps have back-end API servers. They usually rely on the API replies to determine whether certain information is supposed to be shown. If the API responses could be manipulated on the fly, we may easily fool an unmodified app to expose some private data.

This manual guides you to set up nginx as non-transparent SSL proxy, which just subsitutes strings in the server responses (i.e. man-in-the-middle attack ourself). For both server-side (their API servers) and client-side (your device), the whole process is almost transparent.