Skip to content

Instantly share code, notes, and snippets.

View xiezhenye's full-sized avatar

Xie Zhenye xiezhenye

View GitHub Profile
redis.replicate_commands()
local key=KEYS[1]
local size=tonumber(ARGV[1]) or 10
local count=tonumber(ARGV[2]) or 10
local duration=tonumber(ARGV[3]) or 1
local qps = count / duration
local ttl = math.ceil(size / qps)
@xiezhenye
xiezhenye / data.py
Created May 23, 2019 15:42
generate sample data, draw baseline
#!/usr/bin/python
import json
import random
import statistics
import matplotlib.pyplot as plot
import numpy
import sys
def g():
package main
import (
"net"
"fmt"
"time"
"context"
)
func Dialer(ctx context.Context, network, address string) (conn net.Conn, err error) {
@xiezhenye
xiezhenye / expr.go
Created July 11, 2017 02:40
eval expression in go
package main
import (
"go/ast"
"go/parser"
"go/token"
"go/constant"
"reflect"
"errors"
"fmt"
from __future__ import print_function
class Node:
def __init__(self, name, children):
self.name = name
self.children = children
tree = Node(1, [
Node(2, [
Node(3, [
class Node:
def __init__(self, name, children):
self.name = name
self.children = children
tree = Node(1, [
Node(2, [
Node(3, [
Node(4, []),