Skip to content

Instantly share code, notes, and snippets.

@luuuua
luuuua / settings.json
Last active November 1, 2022 11:31
VS Code Theme simulate source insight color scheme
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
"parameter": "#007fff",
"type.fileScope": {
"foreground": "#0000ff"
},
"function": {
"foreground": "#00007f"
@luuuua
luuuua / effective_modern_cmake.md
Created May 23, 2022 06:54 — forked from mbinna/effective_modern_cmake.md
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>
static void print_stacktrace()
{
int size = 64;
void * array[64];
int stack_num = backtrace(array, size);
char ** stacktrace = backtrace_symbols(array, stack_num);
#define BROADCAST_PREFIX "am broadcast -a MEDIA_PLAY_MONITOR_MESSAGE"
int send_broadcast(const char* , ...) __attribute__((format(printf,1,2)));
int send_broadcast(const char* format, ...){
char *str = (char*)calloc(1024, 1);
char c, *s, *start = str;
int32_t qualifier, len, i;
str += sprintf(str, BROADCAST_PREFIX);