Skip to content

Instantly share code, notes, and snippets.

Jialin Wu linnv

Block or report user

Report or block linnv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@linnv
linnv / mergesort.go
Last active Jul 31, 2019
merge sort parallelly, reuse slice
View mergesort.go
package main
import (
"sync"
)
const parallelBySliceLength = 1 << 10 * 3
func MergeSortLoop(src []int64) {
srcReadOnly := make([]int64, len(src))//update only in merge stage
@linnv
linnv / qps-rate-limiting.go
Last active Mar 14, 2019
HTTP QPS rate limiting in Golang
View qps-rate-limiting.go
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"time"
@linnv
linnv / adding-version.go
Last active Sep 2, 2017
auto update app version from git for Golang
View adding-version.go
package main
import (
"flag"
"os"
"strings"
)
var (
Version = "1.0.0"
@linnv
linnv / mongodb-multi-collection-query-by-go.go
Last active Jun 6, 2017
multi collection querying using aggregation pipeline implemented by go
View mongodb-multi-collection-query-by-go.go
// import (
// "fmt"
// "time"
//
// mgo "gopkg.in/mgo.v2"
// "gopkg.in/mgo.v2/bson"
// )
// ``` cmd in mongo shell
// db.Slot.aggregate([
@linnv
linnv / redis-sub-pub-golang-demo.go
Last active Jul 11, 2016
redis sub/pub demo implement by golang
View redis-sub-pub-golang-demo.go
package main
import (
"encoding/json"
"fmt"
"log"
"time"
"gopkg.in/redis.v2"
)
View dockerctl.sh
#!/usr/bin/env bash
cids=`docker ps -a | awk 'FNR>1 {print $1}'`
function stop() {
for v in $cids
do
echo "stop "$v
docker stop $v
done
You can’t perform that action at this time.