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
function allowOriginFunc(allowOrigins) { | |
if (allowOrigins.length == 0) { | |
return function(o) { return true; }; | |
} | |
var origins = [], wildcards = []; | |
allowOrigins.forEach(function(o) { | |
var i = o.indexOf('*'); | |
if (i == -1) { |
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
function backoff_delay { | |
local -r -i factor=${BACKOFF_FACTOR-2} | |
local -i min=$(($1*$factor)) | |
local -r -i max=$2 | |
if [[ $max < $min ]]; then | |
min=$max | |
fi | |
echo $min | |
} |
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
package main | |
import ( | |
"bufio" | |
"crypto/tls" | |
"crypto/x509" | |
"errors" | |
"flag" | |
"fmt" | |
"io" |
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
#!/bin/bash | |
function isdigit() { | |
local digit='^[+-]?[0-9]+$' | |
if [[ $1 =~ $digit ]]; then | |
return 0 | |
fi | |
return 1 | |
} |
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
#!/bin/bash | |
redis-cli -p 7000 cluster set-config-epoch 1 | |
redis-cli -p 7001 cluster set-config-epoch 1 | |
redis-cli -p 7000 cluster reset | |
redis-cli -p 7001 cluster reset | |
redis-cli -p 7000 cluster addslots $(seq -s " " 0 16383) |
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> | |
#include <strings.h> | |
#define MAX_LEN 300001 | |
typedef struct _rope { | |
int offset, len, size; | |
char *s; | |
struct _rope *left, *right, *parent; |
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
package main | |
import ( | |
"testing" | |
"unicode" | |
"unicode/utf8" | |
"github.com/stretchr/testify/assert" | |
) |