git config --global alias.tree "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
git tree
* c3aee36 - (HEAD -> master, tag: DAY01, origin/master, origin/HEAD) '' (2 minutes ago) <r-lyeh>
* 5c978e9 - Initial commit (4 minutes ago) <r-lyeh>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*(utf8) | |
1€ Filter, template-compliant version | |
Jonathan Aceituno <join@oin.name> | |
25/04/14: fixed bug with last_time_ never updated on line 40 | |
For details, see http://www.lifl.fr/~casiez/1euro | |
*/ | |
#include <cmath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a few color space conversions in c++11, original code by mjijackson.com | |
// - rlyeh, public domain licensed. | |
#include <tuple> | |
#include <algorithm> | |
#include <stdint.h> | |
std::tuple<float,float,float> rgb2hsl( float r, float g, float b ) { // ranges: input[0..255], output[0..1] | |
r /= 255, g /= 255, b /= 255; | |
float max = std::max(std::max(r, g), b), min = std::min(std::min(r, g), b); | |
float h, s, l = (max + min) / 2; | |
if( max != min ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Mike F */ | |
#include <stdint.h> | |
void *memalign( int align, size_t size ) { | |
void *mem = malloc( size + (align-1) + sizeof(void*) ); | |
if(!mem) return 0; | |
char *amem = ((char*)mem) + sizeof(void*); | |
amem += (align - ((uintptr_t)amem & (align - 1)) & (align-1)); | |
((void**)amem)[-1] = mem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Testing read file speed for the three read functions from | |
http://cpp.indi.frih.net/blog/2014/09/how-to-read-an-entire-file-into-memory-in-cpp/ | |
compile with -std=c++11 | |
*/ | |
#include <type_traits> | |
#include <ostream> | |
#include <sstream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
#include <utility> | |
void internal_func(const std::string& s) | |
{ | |
std::cout << s << '\n'; | |
} | |
template <typename ... T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// another small variant class | |
// - rlyeh, public domain | |
#pragma once | |
#include <string> | |
#include <sstream> | |
template< typename T > | |
inline T as( const std::string &self ) { | |
T t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
int main( int argc, const char **argv ) { | |
if( argc >= 3 ) { | |
float cycle = atof(argv[1]); | |
float distance = atof(argv[2]); | |
float excess = fmodf( distance, cycle ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// map<K,V> interpolator (requires keys and values with arithmetical operators) | |
// - rlyeh, public domain | |
#pragma once | |
#include <algorithm> | |
enum { | |
// supported easings | |
at_linear = 0, | |
at_quadinout = 1, | |
// default configuration (feel free to customize) | |
at_interpolator = at_quadinout, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [ref] https://www.niksula.hut.fi/~hkankaan/Homepages/changeable%20colors.html | |
// This is my example picture. Now I want to make that red ball to be brown, green to be yellow and blue to be white. Notice that this picture also has antialiased lines. | |
//slide(x,y) means an array slide(from color,to color) | |
//these three lines make channel 0 (red channel) brown | |
//(172 red, 108 green and 48 blue equals brown) | |
slide(0,0) = 172 | |
slide(0,1) = 108 | |
slide(0,2) = 48 |