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 <iostream> | |
#include <fstream> | |
#define N 10 | |
#define M 12 | |
using namespace std; | |
char lake[10][12]; |
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 <iostream> | |
#define MAX_N 20 | |
using namespace std; | |
int a[MAX_N]; | |
int n, k; | |
bool dfs(int i, int sum) { |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
struct X | |
{ | |
int val; | |
void out(const string& s, int nv) { |
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
<source> | |
type tail | |
format apache2 | |
path /var/log/apache2/access_log | |
pos_file /var/log/fluent/tmp/apache2.access_log.pos | |
tag s3.apache.access | |
</source> | |
# S3 plugin test | |
<match s3.*.*> |
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
#ifndef BINARY_OP_H | |
#define BINARY_OP_H | |
#include <vector> | |
#include <sstream> | |
using namespace std; | |
// see http://d.hatena.ne.jp/kobapan/20090208/1281901941 |
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/utility/binary.hpp> | |
#include <iostream> | |
using namespace std; | |
#define B(x) BOOST_BINARY(x) | |
void row1() { | |
cout << "# row1" << endl; | |
cout << (B(0110) + B(0010)) << endl; |
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 <iostream> | |
using namespace std; | |
// see http://d.hatena.ne.jp/kobapan/20090208/1281901941 | |
int strbin2i (const std::string &s) { | |
int out = 0; | |
for (int i = 0, size = s.size() ; i < size ; ++i ) { | |
out *= 2; | |
out += ((int)s[i] == 49) ? 1 : 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 <iostream> | |
#define df(f) cout << "# " << f << endl | |
using namespace std; | |
void get_bit(int num, int i) { | |
df(__func__ << "(" << num << ", " << i << ")"); | |
cout << "Get " << i << "'th bit is : "; | |
cout << ((num & (1 << i)) != 0) << endl; |
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
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_METHOD} ^OPTIONS | |
RewriteRule .* - [R=405,L] | |
</IfModule> |
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
# Implementation for HTTP OPTIONS method in rails 3.2.13 | |
# inspired by https://gist.github.com/ajturner/832700 | |
# routes.rb | |
match '/*any_path', :controller => 'application', :action => 'method_for_options_method', :constraints => { :method => 'OPTIONS' } | |
# application_controller.rb | |
def method_for_options_method | |
render :nothing => true, :status => 200 | |
end |