This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.iml | |
.gradle | |
/local.properties | |
/.idea | |
.DS_Store | |
/build | |
/captures | |
*.cxx | |
app/.cxx/* | |
.externalNativeBuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set a new remote | |
$ git remote add origin https://github.com/user/repo.git | |
# Update a remote url | |
$ git remote set-url origin https://github.com/user/repo.git | |
# Verify new remote | |
$ git remote -v | |
> origin https://github.com/user/repo.git (fetch) | |
> origin https://github.com/user/repo.git (push) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//from https://github.com/vecio/MediaCodecDemo | |
package io.vec.demo.mediacodec; | |
import java.nio.ByteBuffer; | |
import android.app.Activity; | |
import android.media.MediaCodec; | |
import android.media.MediaCodec.BufferInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var yData = ByteArray(1) | |
var uData = ByteArray(1) | |
var vData = ByteArray(1) | |
for (i in 0 until 3) { | |
val plane = image.planes[i] | |
val bytes = ByteArray(plane.buffer.remaining()) | |
plane.buffer.get(bytes) | |
when(i) { | |
0 -> yData = bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==================== pull from Facebook/rockdb@github ==================== | |
class ListJni { | |
public: | |
// Get the java class id of java.util.List. | |
static jclass getListClass(JNIEnv* env) { | |
jclass jclazz = env->FindClass("java/util/List"); | |
assert(jclazz != nullptr); | |
return jclazz; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobject StlStringStringMapToJavaHashMap(JNIEnv *env, const std::map<std::string, std::string>& map) { | |
jclass mapClass = env->FindClass("java/util/HashMap"); | |
if(mapClass == NULL) | |
return NULL; | |
jmethodID init = env->GetMethodID(mapClass, "<init>", "()V"); | |
jobject hashMap = env->NewObject(mapClass, init); | |
jmethodID put = env->GetMethodID(mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); | |
std::map<std::string, std::string>::const_iterator citr = map.begin(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <random> | |
std::random_device rd; // only used once to initialise (seed) engine | |
std::mt19937 rng(rd()); // random-number engine used (Mersenne-Twister in this case) | |
std::uniform_int_distribution<int> uni(minValue, maxValue); // guaranteed unbiased | |
int randomInt = uni(rng); |