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
void split( const std::string& str, char delim, std::vector<std::string>& tokens ) | |
{ | |
std::stringstream iss(str); | |
std::string item; | |
while ( std::getline(iss, item, delim) ) | |
{ | |
if ( !item.empty() ) | |
tokens.push_back(item); | |
} | |
} |
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
void chop( std::string& str, const std::string& whitespaces=" \t\f\v\n\r" ) | |
{ | |
size_t found = str.find_last_not_of( whitespaces ); | |
if ( found!=std::string::npos ) | |
str.erase( found+1 ); | |
else | |
str.clear(); | |
} |
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
namespace | |
{ | |
struct add_delimiter | |
{ | |
add_delimiter( const std::string& d ) | |
{ delimiter = d; } | |
std::string operator()( const std::string& lhs, const std::string& rhs ) | |
{ return lhs + (lhs.empty() ? "" : delimiter) + rhs; } | |
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
void trim( std::string& str, const std::string& whitespaces=" \t\f\v\n\r" ) | |
{ | |
size_t found = str.find_first_not_of( whitespaces ); | |
if ( found!=std::string::npos ) | |
str.erase( 0, found ); | |
else | |
str.clear(); | |
} |
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
void replace( const std::string& from, const std::string& to, std::string& str ) | |
{ | |
size_t pos; | |
while ( (pos=str.find(from)) != std::string::npos ) | |
str.replace( pos, from.size(), to ); | |
} |
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
#ifdef __SSSE3__ | |
# include <xmmintrin.h> | |
# include <tmmintrin.h> | |
#endif | |
posix_memalign((void**)&pixels, 16, sizeof(unsigned int)*PIXEL_COUNT); | |
/* | |
* Mind this will only work for width * height % 16 == 0 textures |
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
$ ./target/rgbdbg | |
RGB debugger 0.0.1 | |
Copyright (C) 2015 Aurelien Vallee | |
License MIT: http://opensource.org/licenses/MIT | |
(rgbdbg) h | |
Commands: | |
help |h List available commands | |
file |f Load Z80 executable binary | |
next |n Step execute the next instruction | |
run |r Run the program until Cpu is stopped |
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 <ctime> | |
std::string now() | |
{ | |
std::time_t tt = std::time(NULL); | |
std::string s = std::ctime(&tt); | |
return s.substr(0, s.size()-1); | |
} |
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 <getopt.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <limits.h> | |
void | |
version(void) | |
{ | |
printf("HTTPMon 1.0.0\n"); |
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
set -g utf8 on | |
set-window-option -g utf8 on | |
set -g status-utf8 on | |
set -s escape-time 0 | |
set -g default-terminal "screen-256color" | |
bind-key -n C-right next | |
bind-key -n C-left prev |
OlderNewer