Skip to content

Instantly share code, notes, and snippets.

View thanhpp's full-sized avatar
👽
cerca trova

Phan Phú Thành thanhpp

👽
cerca trova
View GitHub Profile
@thanhpp
thanhpp / binance-get-all-coin-info.json
Created July 26, 2023 04:36
binance-get-all-coin-info
[
{
"coin": "AGLD",
"depositAllEnable": true,
"free": "0",
"freeze": "0",
"ipoable": "0",
"ipoing": "0",
"isLegalMoney": false,
"locked": "0",
@thanhpp
thanhpp / timeseriescache.go
Last active September 13, 2022 06:42
time series price cache
package timeseriescache
import (
"sync"
"time"
"go.uber.org/zap"
)
const (
@thanhpp
thanhpp / exampleLogger.go
Last active August 10, 2022 08:03
exampleLogger.go
type A1 struct {
logger *zap.SuggaredLogger
}
type A2 struct {
logger *zap.SuggaredLogger
}
type A struct {
logger *zap.SuggaredLogger
@thanhpp
thanhpp / kyber_test_idx.go
Created April 2, 2022 03:09
kyber_test_idx
func check(j, arrLength int) bool {
return j < (arrLength-1)
}
func Query1(arr []int, queries [][2]int) {
var queryResult int
for _, q := range queries {
if check(q[1], len(arr)) {
log.Fatalf("Invalid query: %d, %d", q[0], q[1])
}
@thanhpp
thanhpp / kyber_test.go
Last active April 2, 2022 02:49
kyber_test
package main
import {
"fmt"
"log"
"pkg/appconfig"
"pkg/dbx"
}
@thanhpp
thanhpp / Dockerfile
Last active March 1, 2022 06:06
etcd-cluster-example
FROM alpine
RUN apk update && apk add --no-cache tar
WORKDIR /etcd
RUN wget https://github.com/etcd-io/etcd/releases/download/v3.5.2/etcd-v3.5.2-linux-amd64.tar.gz
RUN tar -xvzf etcd-v3.5.2-linux-amd64.tar.gz
RUN rm -f etcd-v3.5.2-linux-amd64.tar.gz
@thanhpp
thanhpp / teko_test2.go
Created January 25, 2022 08:28
teko_test2.go
package main
import (
"fmt"
)
func main() {
var (
input = []int{1, 2, 3, 4, 5, 6, 7}
k int = 4
@thanhpp
thanhpp / teko_test1.go
Created January 25, 2022 07:29
teko_test1.go
package main
import (
"fmt"
"sort"
)
func main() {
var (
req = []string{"812", "82", "7", "23", "12", "34"}
@thanhpp
thanhpp / kmp.go
Last active November 8, 2021 06:50
KMP matching
package main
import (
"fmt"
)
func Failure(s string) []int {
res := make([]int, len(s))
for i := range s {
var max int
@thanhpp
thanhpp / Bayer-Moore.go
Last active November 1, 2021 07:08
Bayer - Moore string matching
package main
import (
"fmt"
)
func main() {
var (
s = 0
P = "acabac"