Skip to content

Instantly share code, notes, and snippets.

View linxGnu's full-sized avatar

Linh Tran Tuan linxGnu

  • H2Corporation
  • Tokyo
  • 11:09 (UTC +09:00)
View GitHub Profile
package internal
import (
"sync"
"testing"
"time"
)
//goos: darwin
//goarch: amd64
// goos: darwin
// goarch: arm64
// pkg: github.com/hashicorp/raft
// BenchmarkTimeAfter-10 436 3896361 ns/op 2152307 B/op 30001 allocs/op
// BenchmarkTimer-10 764 1399790 ns/op 2000058 B/op 30001 allocs/op
// BenchmarkWithoutDefer-10 3362208 356.1 ns/op 0 B/op 0 allocs/op
// BenchmarkWithDefer1-10 406236 2952 ns/op 0 B/op 0 allocs/op
// BenchmarkWithDefer2-10 404098 2956 ns/op 0 B/op 0 allocs/op
const timerBenchAttempt = 10000
package main
import (
"bytes"
"sync"
"sync/atomic"
"testing"
)
func BenchmarkAtomicValue(b *testing.B) {
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"sync"
"sync/atomic"
"time"
@linxGnu
linxGnu / gosmpp_sample.go
Created September 13, 2019 00:38
Connect to SMSC for sending MT and receiving MO via Session Manager
package daemon
import (
"context"
"fmt"
"math"
"os"
"strconv"
"sync"
"time"
package main
import (
"encoding/binary"
"fmt"
"time"
"github.com/dgraph-io/badger"
)
func solveSudoku(board [][]byte) {
convertBoard(board)
// solve sudoku
rows := make([][]bool, 9)
for i := range rows {
rows[i] = make([]bool, 10)
}
cols := make([][]bool, 9)
package main
import (
"bytes"
"io"
"github.com/pierrec/lz4"
)
var payload = []byte{
@linxGnu
linxGnu / workerpool.go
Created February 19, 2019 09:55
We will publish this code soon. This code is a worker pool power many products at LINE Corp. Please respect to the copyright.
// Copyright 2019 LINE Corporation
//
// LINE Corporation licenses this file to you under the Apache License,
// version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
@linxGnu
linxGnu / grpclz4.go
Created February 16, 2019 04:11
lz4 encoding for gRPC (connection) encoding. We (at LINE Corp) will try to publish it soon.
// Copyright 2019 LINE Corporation
//
// LINE Corporation licenses this file to you under the Apache License,
// version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT