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> | |
#include <string> | |
#include <algorithm> | |
using namespace std; | |
string operator "" _rev(char const *p, size_t sz) | |
{ | |
string rev(p, sz); | |
reverse(rev.begin(), rev.end()); |
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
diff --git a/bench/db-bench.c b/bench/db-bench.c | |
index bf6dbfc..6207b42 100644 | |
--- a/bench/db-bench.c | |
+++ b/bench/db-bench.c | |
@@ -20,6 +20,7 @@ | |
#include <time.h> | |
#include <sys/time.h> | |
#include <string.h> | |
+#include <signal.h> | |
#include "../engine/util.h" |
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
time_in_sec total_inserted inserts_per_sec | |
0 0 0 | |
1 170000 170000 | |
2 330000 160000 | |
3 440000 110000 | |
4 590000 150000 | |
5 730000 140000 | |
6 870000 140000 | |
7 1010000 140000 | |
8 1150000 140000 |
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
-- Group blocks together. | |
import Data.List (intersperse) | |
grp :: [Int] -> [(Int,Int)] | |
grp [] = [] | |
grp (x:xs) = pair x x xs where | |
pair lo hi (x:xs) | x == hi + 1 = pair lo x xs | |
pair lo hi xs | otherwise = (lo,hi): grp xs |
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
[ | |
{ | |
"disabled": ["*"] | |
}, | |
{ | |
"enabled": ["GET", "SET", "INCR"] | |
} | |
] |
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
-module(test). | |
-export([allowed/1]). | |
% null case | |
allowed([]) -> | |
[]; | |
% single element case | |
allowed([E]) -> | |
[[E]]; |
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
*4\r\n | |
$4\r\n | |
ZADD\r\n | |
$4\r\n | |
key1\r\n | |
$3\r\n | |
123\r\n | |
$6\r\n | |
query1\r\n |
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
fileCopyNoComment infile outfile = do | |
contents <- readFile infile | |
let out = map (fst . break (== '%')) $ lines contents | |
writeFile outfile $ unlines out |
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
module Main where | |
import System.Environment | |
import Control.Concurrent | |
import Control.Monad | |
process i inbox outbox = do | |
msg <- takeMVar inbox -- read message from inbox | |
when (i /= 0 || msg == 0) (putMVar outbox $! msg) -- all except the last node forward their message | |
when (msg /= 0) (process i inbox outbox) -- when not at the last message, recur. |
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
module Main where | |
data Bst a = Nil | Node { | |
elt :: a, | |
l :: Bst a, | |
r :: Bst a} deriving Show | |
insert_ntr Nil x = Node x Nil Nil | |
insert_ntr n x | x < elt n = n {l = insert_ntr (l n) x} | |
| x > elt n = n {r = insert_ntr (r n) x} |