This file contains hidden or 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 onCompleted(evhttp_request *req, void* arg) | |
{ | |
fprintf(stderr, "Request completed\n"); | |
fwrite(req->input_buffer->buffer, 1, req->input_buffer->off, stderr); | |
fprintf(stderr, "\n"); | |
} | |
int main(int argc, char **argv) | |
{ | |
char const *address = argv[1]; |
This file contains hidden or 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
RE2 link("(?ims)(?:\\<a([^\\>]+)href=\\\")([^\\\"]+)\\\""); | |
re2::StringPiece content(html_text); | |
string match; | |
string domain; | |
while(RE2::FindAndConsume(&content, link, (void*)0, &match)){ | |
if(match[0] == '/'){ | |
if(!domain.size()){ | |
evbuffer_add_printf(evb, "Domain name required.\n"); | |
evhttp_send_reply(req, HTTP_BADREQUEST, "Client", evb); | |
break; |
This file contains hidden or 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
// compile with g++ icu-detect.cpp -I /usr/local/include -L /usr/local/lib -licuuc -licudata -licui18n | |
#include <cstdio> | |
#include <string> | |
#include <cassert> | |
#include "unicode/ucsdet.h" | |
#include "unicode/uclean.h" | |
int main(int argc, char **argv) | |
{ | |
using namespace std; |
This file contains hidden or 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
/**************** | |
* Acer Yang, GAIS Laboratory, Univ. CCU, Taiwan. | |
* | |
* g++ -I/usr/local/include -L/usr/local/lib unicode-convert.cpp -licui18n -o uconv | |
* ./uconv input file charset_name | |
* | |
********/ | |
#include "unicode/ucnv.h" |
This file contains hidden or 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
#!/bin/sh | |
# Dependencies: | |
# 1. gprof | |
# 2. gprof2dot | |
# 3. c++filt | |
# 4. dot (/usr/ports/x11-fonts/urwfonts) | |
help="profcg.sh executable output" |
This file contains hidden or 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
/** | |
* FreeBSD 8.2 | |
* g++ -I /usr/local/include newline_array_src.cpp | |
**/ | |
#include <boost/iostreams/filtering_stream.hpp> | |
#include <boost/iostreams/filter/newline.hpp> | |
#include <boost/iostreams/device/array.hpp> | |
#include <string> | |
#include <cstring> |
This file contains hidden or 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
int main() | |
{ | |
using namespace std; | |
using namespace BDB; | |
using BDB::Structure::HashMap; | |
Config conf; | |
conf.beg = 1; | |
conf.end = 10; | |
conf.root_dir = argv[1]; |
This file contains hidden or 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 <iostream> | |
#define CERR std::cerr << __FILE__ << ":" << \ | |
std::dec << __LINE__ << ":" <<__FUNCTION__ << "() : " |
This file contains hidden or 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
#if defined(__GNUC__) && !defined(__clang__) | |
#define GNUC_EXCLUDE_CLANG | |
#else | |
#undef GNUC_EXCLUDE_CLANG | |
#endif |
This file contains hidden or 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 <typeinfo> | |
#include <memory> | |
#ifdef __GNUC__ | |
#include <cxxabi.h> | |
template<typename T> | |
struct getname | |
{ | |
std::string operator()() |
OlderNewer