Skip to content

Instantly share code, notes, and snippets.

View linxGnu's full-sized avatar

Linh Tran Tuan linxGnu

  • H2Corporation
  • Tokyo
  • 05:51 (UTC +09:00)
View GitHub Profile
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"sync"
"time"
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net/http"
package main
import (
"fmt"
"log"
"sync"
"time"
"github.com/influxdata/influxdb/client/v2"
)
reporting-disabled = true
[meta]
# Where the metadata/raft database is stored
dir = "/Users/gnu/.influxdb/meta"
# Automatically create a default retention policy when creating a database.
# retention-autocreate = true
# If log messages are printed for the meta service
coordinator:
listenAddress: 0.0.0.0:7201
metrics:
scope:
prefix: "coordinator"
prometheus:
handlerPath: /metrics
listenAddress: 0.0.0.0:7203 # until https://github.com/m3db/m3db/issues/682 is resolved
sanitization: prometheus
@linxGnu
linxGnu / m3db.write.go
Created July 19, 2018 05:13
M3DB Standalone - Write Benchmark
package main
import (
"fmt"
"log"
"sync"
"time"
"github.com/m3db/m3db/src/dbnode/client"
"github.com/m3db/m3db/src/dbnode/sharding"
package main
import (
"fmt"
"time"
)
const (
numberOperations = 100000000
)
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
public class bench {
public static int numRequest = 100000;
public static int numEndpoints = 500;
public static void main(String[] args) throws Exception {
@linxGnu
linxGnu / SolutionAlgoWeek2.txt
Last active December 14, 2017 08:51
Solution for week-2
`Bài 1: https://leetcode.com/problems/divide-two-integers/description`
Có 2 cách cơ bản để biểu diễn một số
1. N = a1^b1 a2^b2 ... an^bn trong đó a1 .. an là các số nguyên tố
2. N = 2^0 * a0 + 2^1 * a1 + ...
Để tính giá trị của phép chia X / Y chẳng hạn. Ta giả sử giá trị này là Z, vì vậy X = Y * Z + số dư.
Biểu diễn Z dưới dạng nhị phân Z = 2^0 * a0 + ... 2^n * an. Ta có: X = Y * (2^0 * a0 + ... + 2^n * an) + số dư.