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
### Keybase proof | |
I hereby claim: | |
* I am bojieli on github. | |
* I am boj (https://keybase.io/boj) on keybase. | |
* I have a public key ASBJWJNZ_y1nUZxwz_dbJj6-lTwHscbg-FgiF5pu-XA_0Ao | |
To claim this, I am signing this object: |
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
/* CVE-2015-5477 POC | |
* An error in handling TKEY queries can cause named to exit with a REQUIRE assertion failure | |
* Affected software: ISC named (bind) 9.1.0 -> 9.8.x, 9.9.0->9.9.7-P1, 9.10.0->9.10.2-P2 | |
* | |
* Copyleft Bojie Li <[email protected]> | |
* | |
* Free to modify and redistribute this program. | |
* Use at your own risk and you are responsible for what you are doing. | |
*/ | |
#include<stdio.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
using namespace std; | |
#include <iostream> | |
#include <cmath> | |
class Complex { | |
private: | |
double real; | |
double im; | |
public: |
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
// compile with "g++ -std=c++11" | |
// to_string in C++11 is used | |
using namespace std; | |
#include <iostream> | |
#include <string> | |
#include <stdexcept> | |
class Date { | |
private: | |
int year; |
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
using namespace std; | |
#include <iostream> | |
int getPower(int x, int n) { | |
if (x == 0) | |
return 0; | |
if (n == 0) | |
return 1; | |
else if (n > 0) | |
return getPower(x, n-1) * x; | |
else // n < 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
using namespace std; | |
#include <iostream> | |
class Complex { | |
private: | |
double real; | |
double im; | |
public: | |
Complex(double real, double im) { |
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<stdio.h> | |
#include<stdlib.h> | |
int main() { | |
int num = 0; | |
int i, j, k; | |
char a[1001][22] = {0}; | |
int idx[1001], tmpidx; | |
char tmp[22] = {0}; | |
while (scanf("%s", a[num++]) != EOF); |
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<stdio.h> | |
#include<stdlib.h> | |
#define HASH_SIZE 300007 | |
#define LINE_LEN 32 | |
char dict[HASH_SIZE][LINE_LEN] = {0}; | |
static unsigned int BKDRhash(char* key) { | |
unsigned int seed = 131; // 31 131 1313 13131 131313 etc.. | |
unsigned int hash = 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<stdio.h> | |
struct cal { | |
int hour, minute, second, day, month, year; | |
}; | |
struct cal convert(struct cal in) { | |
struct cal out; | |
in.year -= 2000; | |
int past_years = in.month >= 3 ? in.year + 1 : in.year; | |
int days = in.year * 365 + (past_years + 3) / 4 - (past_years + 99) / 100 + (past_years + 399) / 400; |
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 SimpleHTTPServer | |
import SocketServer | |
import urlparse | |
PORT = 80 | |
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
try: | |
query = urlparse.parse_qs(urlparse.urlparse(self.path).query) |
NewerOlder