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
/// using standard library | |
#include <chrono> | |
#include <thread> | |
std::this_thread::sleep_for(std::chrono::seconds(10)); // delay for 10s | |
std::this_thread::sleep_for(std::chrono::milliseconds(10)); // delay for 10ms | |
std::this_thread::sleep_for(std::chrono::nanoseconds(10)); // delay for 10ns |
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
# get remote repository | |
git clone URL | |
# create new branch | |
git branch new_branch_name | |
git branch | |
git push origin new_branch_name | |
# delete branch | |
git branch -d branch_name |
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
// ... | |
android { | |
// ... | |
libraryVariants.all { variant -> | |
variant.outputs.all { output -> | |
variant.assemble.doLast { | |
exec { | |
def localProperties = new File(rootDir, "local.properties") |
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 <dlfcn.h> | |
void (*ATrace_beginSection) (const char *sectionName); | |
void *(*ATrace_endSection) (void); | |
void *(*ATrace_isEnabled) (void); | |
typedef void (*fp_ATrace_beginSection) (const char *sectionName); | |
typedef void *(*fp_ATrace_endSection) (void); | |
typedef void *(*fp_ATrace_isEnabled) (void); |
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 "shader_handler.h" | |
bool ShaderHandler::initializeShader() { | |
// vertex shader | |
vshader = glCreateShader(GL_VERTEX_SHADER); | |
glShaderSource(vshader, 1, &vertex_shader_source, nullptr); | |
glCompileShader(vshader); | |
GLint vertex_compiled; | |
glGetShaderiv(vshader, GL_COMPILE_STATUS, &vertex_compiled); |
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 "render_frame.h" | |
void RenderFrame::initialize() { | |
glGenTextures(1, &colorAttachmentId); | |
glBindTexture(GL_TEXTURE_2D, colorAttachmentId); | |
glBindTexture(GL_TEXTURE_2D, 0); // unbind | |
} | |
void RenderFrame::submitFrame(void *frame) { | |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_RED); |
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
dependencies { | |
// Navigation library | |
def nav_version = "2.0.0" | |
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" | |
implementation "androidx.navigation:navigation-ui-ktx:$nav_version" | |
} |
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
dependencies { | |
// CameraX core library | |
def camerax_version = "1.0.0-alpha06" | |
// CameraX view library | |
def camerax_view_version = "1.0.0-alpha03" | |
// CameraX extensions library | |
def camerax_ext_version = "1.0.0-alpha03" | |
implementation "androidx.camera:camera-core:$camerax_version" | |
// If you want to use Camera2 extensions | |
implementation "androidx.camera:camera-camera2:$camerax_version" |
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
import java.util.*; | |
public class BreathFirstSearch { | |
public static bfs(Node tree) { | |
// using queue for BFS algorithm | |
Queue<Node> queue = new LinkedList<>(); | |
// enqueue root | |
queue.add(tree); | |
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
// the path of output folder | |
private val EXPORT_FOLDER = "/your/folder/path/" | |
// this is a trigger for enabling/disabling the function | |
private var exportFrameToJpeg = false | |
// a counter which acculating the number of video frame | |
private var nbFrame = 0 | |
// the prepare function of decoder |
NewerOlder