Skip to content

Instantly share code, notes, and snippets.

@yangacer
yangacer / icu-detect.cpp
Created July 6, 2011 14:11
ICU charset detection
// 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;
@yangacer
yangacer / extract_link.cpp
Created June 26, 2011 15:07
Extract link from HTML using RE2
@yangacer
yangacer / evreq.c
Created May 2, 2011 13:33
Send request via evhttp (1.4)
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];