Skip to content

Instantly share code, notes, and snippets.

Yan Huang FinalTheory

Block or report user

Report or block FinalTheory

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
FinalTheory / test.cpp
Created Dec 26, 2018
std::cout cause frash
View test.cpp
// g++ test.cpp -static -o test -std=c++11
// ./test
struct Foo
} foo;
#include <iostream>
FinalTheory / example.cpp
Last active Dec 4, 2018
Minimal framework internal cost demo
View example.cpp
// g++ example.cpp -O2 -std=c++11 -o example
#include <cstdlib>
#include <string>
#include <chrono>
#include <thread>
#include <mutex>
#include <vector>
#include <functional>
#include <condition_variable>
#include <iostream>
#include <type_traits>
template<typename ... Args>
struct get_size;
struct get_size<> {
static constexpr int size = 0;
FinalTheory / hanoi.cpp
Last active May 22, 2017
C++ Template Hanoi
View hanoi.cpp
#include <iostream>
#include <utility>
template <typename T, T a, T b>
struct pair {
static constexpr auto first = a;
static constexpr auto second = b;
static void print() { std::cout << first << "->" << second << std::endl; }
FinalTheory / gist:796c4496e366832254f5ab523cdd9ec3
Created May 19, 2017 — forked from mattbierner/gist:090a80d25259b6472827
Compile Time Brainfuck C++ Metaprogramming Evaluator
View gist:796c4496e366832254f5ab523cdd9ec3
#include <utility>
using iochar = char;
using memval = unsigned char;
/* BF Memory Cell */
template <memval val = 0>
struct Cell {
enum { value = val };
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: 黄龑(
# Created Time: 2016/08/18 14:23
# File Name:
# Description:
# Copyright (c) 2015, Inc. All Rights Reserved
FinalTheory / divert_mem_pool.c
Last active Jan 24, 2016
Simple lock-free memory pool based on linked list
View divert_mem_pool.c
#include "divert_mem_pool.h"
#include <stdlib.h>
divert_mem_pool_t *divert_create_pool(size_t max_alloc) {
divert_mem_pool_t *pool =
calloc(sizeof(divert_mem_pool_t), 1);
if (pool == NULL) {
return NULL;
FinalTheory / CMakeLists.txt
Created Sep 24, 2015
C extension中发起新线程回调Python函数时未获取GIL导致core的演示代码
View CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
set(SOURCE_FILES demo.c)
# if you could not build successfully or error occured when importing nids
You can’t perform that action at this time.