Skip to content

Instantly share code, notes, and snippets.

@russell-shizhen
russell-shizhen / dbg.h
Created August 28, 2020 02:11 — forked from dweinstein/dbg.h
debug macros for C/C++ and maybe JNI android development
#ifndef __dbg_h__
#define __dbg_h__
#include <stdio.h>
#include <errno.h>
#include <string.h>
// Debug tag
#define DTAG "DBG"
import org.spongycastle.asn1.ASN1Encodable;
import org.spongycastle.asn1.ASN1Primitive;
import org.spongycastle.asn1.pkcs.PrivateKeyInfo;
import org.spongycastle.asn1.pkcs.RSAPrivateKey;
import org.spongycastle.crypto.params.AsymmetricKeyParameter;
import org.spongycastle.crypto.params.RSAKeyParameters;
import org.spongycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi;
import org.bouncycastle.util.io.pem.PemObject;
import org.bouncycastle.util.io.pem.PemWriter;
@russell-shizhen
russell-shizhen / Memos for building an Android Library project.md
Created October 17, 2018 09:24
Memos for building an Android Library project

Library build variants

Consider what features/functionalities

  • Debug
  • Release

Public API

Only expose the ones necessary

This can leave more flexibility to future API changes without breaking the APIs exposed in earlier versions.

Initial verification using code snippets to illustrate the API flow.

@russell-shizhen
russell-shizhen / restart android emulator in command line
Last active May 31, 2024 06:31
restart android emulator in command line on MacOS
#!/bin/bash -ex
# NOTE: ANDROID_HOME must be configured as an environment variable.
# Kill all the existing adb servers and start over a new adb server.
function restart_adb_server() {
echo "********************* Restarting adb ... *********************"
adb kill-server
sleep 2
adb start-server
sleep 2
@russell-shizhen
russell-shizhen / inline a c function
Last active July 9, 2018 08:19
inline a c function for Android NDK clang compiler
static inline __attribute__((always_inline)) void foo() {
}