This is good for entertainment purposes as it shows how to encode individual instructions and how to play with mmap() to actually execute the generated code. However, for anything practical I would recommend AsmJit as it offers a lot of features and makes JIT code generation fun.