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
// answer to http://weibo.com/1915548291/z2UtyzuvQ | |
// see also http://www.cnblogs.com/baiyanhuang/archive/2012/11/11/2764914.html | |
#include <boost/bind.hpp> | |
#include <boost/function.hpp> | |
#include <boost/noncopyable.hpp> | |
#include <boost/ptr_container/ptr_vector.hpp> | |
#include <fstream> | |
#include <iostream> |
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
// answer to http://blog.zhaojie.me/2012/11/how-to-generate-typoglycemia-text.html | |
#include <algorithm> | |
#include <iostream> | |
#include <string> | |
#include <assert.h> | |
#include <ctype.h> | |
using std::string; | |
void randomizeWord(char* str, int len) |
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
import java.lang.reflect.Field; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import JaCoP.constraints.Alldifferent; | |
import JaCoP.constraints.Distance; | |
import JaCoP.constraints.XeqC; | |
import JaCoP.constraints.XeqY; | |
import JaCoP.constraints.XplusCeqZ; | |
import JaCoP.core.Domain; |
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 <assert.h> | |
#include <memory.h> | |
#include <stdio.h> | |
#include <algorithm> | |
#include <vector> | |
#include <string> | |
using namespace std; | |
struct Node; |
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 <algorithm> | |
#include <iostream> | |
#include <unordered_map> | |
#include <vector> | |
typedef std::unordered_map<std::string, int> WordCount; | |
struct Greater | |
{ | |
bool operator()(const std::pair<int, WordCount::iterator>& lhs, |
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 <set> | |
#include <stdio.h> | |
#include <sys/time.h> | |
double now() | |
{ | |
struct timeval tv; | |
gettimeofday(&tv, NULL); | |
return tv.tv_sec + tv.tv_usec / 1000000.0; |
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 <muduo/base/Mutex.h> | |
#include <muduo/base/Thread.h> | |
#include <boost/shared_ptr.hpp> | |
#include <stdio.h> | |
boost::shared_ptr<int> g; | |
muduo::MutexLock mutex; | |
void read_g() | |
{ |
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 <algorithm> | |
#include <fstream> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
bool covered(const vector<string>& filters, const string& line) | |
{ |
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 <event2/listener.h> | |
#include <event2/bufferevent.h> | |
#include <event2/buffer.h> | |
#include <arpa/inet.h> | |
#include <netinet/tcp.h> | |
#include <assert.h> | |
#include <signal.h> | |
#include <string.h> |
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 <boost/noncopyable.hpp> | |
#include <pthread.h> | |
#include <stdlib.h> | |
// a superfluous check for pedantic people | |
inline void CHECK_SUCCESS(int ret) | |
{ | |
if (ret != 0) | |
{ | |
abort(); |