Skip to content

Instantly share code, notes, and snippets.

View mcraveiro's full-sized avatar

Marco Craveiro mcraveiro

View GitHub Profile
//
// echo_server.cpp
// ~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2015 Andrew Hundt
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@staltz
staltz / introrx.md
Last active May 24, 2024 07:56
The introduction to Reactive Programming you've been missing
@randomphrase
randomphrase / cmdoptions.cpp
Last active February 17, 2023 05:51
Demonstration of how to do subcommand option processing with boost program_options
#define BOOST_TEST_MODULE subcommand options
#include <boost/test/unit_test.hpp>
#include <boost/program_options.hpp>
#include <boost/variant/variant.hpp>
#include <boost/variant/get.hpp>
struct GenericOptions {
bool debug_;
};
@FelipeCortez
FelipeCortez / listings.tex
Last active March 14, 2024 16:35
LaTeX pretty listings
\usepackage{listings}
\usepackage{lstautogobble} % Fix relative indenting
\usepackage{color} % Code coloring
\usepackage{zi4} % Nice font
\definecolor{bluekeywords}{rgb}{0.13, 0.13, 1}
\definecolor{greencomments}{rgb}{0, 0.5, 0}
\definecolor{redstrings}{rgb}{0.9, 0, 0}
\definecolor{graynumbers}{rgb}{0.5, 0.5, 0.5}
@magnusbae
magnusbae / git-stop-tracking-remote-branch.md
Created April 8, 2014 20:05
How to make Git stop track a remote branch without deleting the remote branch.

You don't have to delete your local branch.

Simply delete your remote tracking branch:

git branch -d -r origin/<remote branch name> (This will not delete the branch on the remote repo!)

See "Having a hard time understanding git-fetch"

there's no such concept of local tracking branches, only remote tracking branches.

#include <boost/bind.hpp>
#include "EventBus.h"
std::hash<std::string> Event::key;
void EventBus::Init()
{
is_io_running = true;
m_work.reset(new boost::asio::io_service::work(io_service));
@blackfalcon
blackfalcon / git-feature-workflow.md
Last active April 13, 2024 07:33
Git basics - a general workflow

Git-workflow vs feature branching

When working with Git, there are two prevailing workflows are Git workflow and feature branches. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited, and the focus of this article.

If you are new to Git and Git-workflows, I suggest reading the atlassian.com Git Workflow article in addition to this as there is more detail there than presented here.

I admit, using Bash in the command line with the standard configuration leaves a bit to be desired when it comes to awareness of state. A tool that I suggest using follows these instructions on setting up GIT Bash autocompletion. This tool will assist you to better visualize the state of a branc

@ddemidov
ddemidov / Makefile
Last active May 29, 2017 19:22
odeint with boost.compute backend
lorenz: lorenz.cpp
g++ -o $@ $^ -std=c++11 -O3 \
-I${HOME}/work/odeint-v2 \
-I${HOME}/work/opencl/compute/include/ \
-lOpenCL -lboost_system -lboost_timer
@krebernisak
krebernisak / git log between tags
Created September 25, 2013 10:04
All commits between two tags/commits
git log [TAG1]..[TAG2] --oneline
@adewes
adewes / generate_random_color.py
Last active March 26, 2024 08:18
A small Python script to generate random color sequences, e.g. for use in plotting. Just call the "generate_new_color(existing_colors,pastel_factor)" function to generate a random color that is (statistically) maximally different from all colors in "existing_colors". The "pastel_factor" parameter can be used to specify the "pasteliness"(?) of th…
import random
def get_random_color(pastel_factor = 0.5):
return [(x+pastel_factor)/(1.0+pastel_factor) for x in [random.uniform(0,1.0) for i in [1,2,3]]]
def color_distance(c1,c2):
return sum([abs(x[0]-x[1]) for x in zip(c1,c2)])
def generate_new_color(existing_colors,pastel_factor = 0.5):
max_distance = None