This file contains hidden or 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; | |
#include <boost/scoped_ptr.hpp> | |
using namespace boost; | |
class clonable{ | |
public: | |
virtual ~clonable(){} | |
virtual clonable *clone() const = 0; |
This file contains hidden or 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; | |
#include <boost/scoped_ptr.hpp> | |
using namespace boost; | |
class clonable{ | |
public: | |
virtual ~clonable(){} | |
virtual clonable *clone() const = 0; |
This file contains hidden or 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
APPNAME = 'gdbtest' | |
VERSION = '0.0.0' | |
srcdir = '.' | |
blddir = 'build' | |
def set_options(opt): | |
opt.tool_options('compiler_cxx') | |
opt.add_option('--gdb', action='store_true', default=False, | |
help='run gdb') |
This file contains hidden or 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
mport Client | |
add :: RpcMethod (Int -> Int -> IO Int) | |
add = method "add" | |
echo :: RpcMethod (String -> IO String) | |
echo = method "echo" | |
main :: IO () | |
main = do |
This file contains hidden or 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
string GetPythonErrorString() | |
{ | |
try{ | |
PyObject *ptype, *pvalue, *ptraceback; | |
PyErr_Fetch(&ptype, &pvalue, &ptraceback); | |
object prev_stderr = import("sys").attr("stderr"); | |
object output_cacher = import("cStringIO").attr("StringIO")(); | |
import("sys").attr("stderr") = output_cacher; |
This file contains hidden or 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
void rsort(uint64_t *a, uint64_t n, uint64_t *b) | |
{ | |
uint32_t cnt[0x4001]={}; | |
for (size_t i=0;i<n;i++) cnt[(a[i]&0x1fff)+1]++; | |
for (size_t i=0;i<0x2000;i++) cnt[i+1]+=cnt[i]; | |
for (size_t i=0;i<n;i++) b[cnt[a[i]&0x1fff]++]=a[i]; | |
std::swap(a, b); | |
for (size_t i=0;i<0x2000;i++) cnt[i]=0; |
This file contains hidden or 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 Data.Vector.Primitive.Mutable | |
import Control.Monad | |
import Prelude hiding (read) | |
newUF :: Int -> IO (IOVector Int) | |
newUF n = do | |
v <- new n | |
forM_ [0..n-1] $ \i -> write v i i | |
return v |
This file contains hidden or 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 <vector> | |
using namespace std; | |
struct a{ | |
a(int &r): r(r) {} | |
a(a &&rr): r(rr.r) {} | |
int &r; | |
}; | |
int main() |
This file contains hidden or 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
{-# LANGUAGE TemplateHaskell #-} | |
module IP where | |
import Control.Applicative | |
import Language.Haskell.TH | |
import Network | |
ipPortFile :: FilePath -> Q Exp | |
ipPortFile fp = do | |
[ip, port] <- runIO $ lines <$> readFile fp |
This file contains hidden or 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
{-# LANGUAGE OverloadedStrings #-} | |
import Data.Monoid | |
import Blaze.ByteString.Builder as B | |
import Blaze.ByteString.Builder.Char.Utf8 as BT | |
import qualified Data.ByteString.Char8 as BS | |
import qualified Data.Text as T | |
import qualified Data.Text.Encoding as T | |
import Criterion.Main |
OlderNewer