Skip to content

Instantly share code, notes, and snippets.

@laobubu
laobubu / ABOUT.md
Last active October 25, 2025 18:35
A very simple HTTP server in C, for Unix, using fork()

Pico HTTP Server in C

This is a very simple HTTP server for Unix, using fork(). It's very easy to use

How to use

  1. include header httpd.h
  2. write your route method, handling requests.
  3. call serve_forever("12913") to start serving on port 12913
@wangmuy
wangmuy / BackTraceUtils.cpp
Created September 13, 2016 10:29
android native stack backtrace
#ifndef BACKTRACE_UTILS_h
#define BACKTRACE_UTILS_h
// ref: http://stackoverflow.com/questions/8115192/android-ndk-getting-the-backtrace
#include <cstdio>
#include <ostream>
#include <sstream>
size_t captureBacktrace(void** buffer, size_t max);
@derofim
derofim / codestyle.md
Last active October 14, 2025 10:53
C++ code style sample
@gabrielepmattia
gabrielepmattia / debug-stack-android.cpp
Created July 24, 2016 09:07
Debug android c++ by printing che callstack in android
#include <utils/CallStack.h>
namespace test {
void myfun(){
android::CallStack stack;
stack.update();
stack.log("<Stack prefix here>");
}
}
@tomykaira
tomykaira / Base64.h
Last active April 23, 2025 22:58
C++ single header base64 decode/encoder for C++ 11 and above.
#ifndef _MACARON_BASE64_H_
#define _MACARON_BASE64_H_
/**
* The MIT License (MIT)
* Copyright (c) 2016-2024 tomykaira
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@dancollins
dancollins / X macros
Created April 7, 2015 08:51
Simple demo showing how X macros can be used to generate an enumeration as well as a string array mapped to that enumeration
/*
* This demo shows how preprocessor macros (formally called X macros) can be
* used to convert one list into both an enumeration and an array of strings.
* This is really useful for converting an enum value into a readable form.
*
* Dan Collins 2015
*/
#include <stdlib.h>
#include <stdio.h>
@jslee02
jslee02 / Event.h
Last active May 16, 2024 08:58
Event
#include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#define LISTENER_COUNT_MAX 256
/// class Event
@subfuzion
subfuzion / global-gitignore.md
Last active September 4, 2025 23:38
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@Geal
Geal / future.c
Last active June 5, 2024 06:49
small future and promise library in C with pthreads
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <stdbool.h>
#include <time.h>
#include <stdarg.h>
#include <string.h>
#include "future.h"
@kodekracker
kodekracker / c++Template.cpp
Last active December 7, 2024 13:53
Basic C++ Template for Competitive Programming
/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
* Example:- $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
/******** All Required Header Files ********/