Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am nnao45 on github.
* I am nnao45 (https://keybase.io/nnao45) on keybase.
* I have a public key ASAGIlUvcHGPDReWzQh3jaKJS3G7Yh-DZRyNKz74NAiLwgo
To claim this, I am signing this object:
cat /dev/urandom | tr -dc "[:graph:]" | tr -d "1Il0O~^" | fold -w 30 | head -n 1
package main
import "fmt"
import "github.com/go-redis/redis"
func RedisNewClient() (client *redis.Client){
client = redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Password: "", // no password set
DB: 0, // use default DB
package main
import (
cryptorand "crypto/rand"
"encoding/binary"
"fmt"
mrand "math/rand"
"time"
)
package main
import (
"fmt"
)
func main() {
ch := make(chan string, 1)
var test string
package main
import "fmt"
func main() {
ch := make(chan string, 3)
go func () {
ch <- fmt.Sprint("Hello World")
ch <- fmt.Sprint("Hello World")
ch <- fmt.Sprint("Hello World")
package main
import (
"fmt"
//"io"
"bufio"
"os"
"time"
)
@nnao45
nnao45 / gist:e4617fec9d51d9ec498f4b4966bc9563
Last active November 7, 2017 15:11
flowspec Error command line, but, not error.
package main
import (
"fmt"
"os"
"strings"
"time"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/config"
@nnao45
nnao45 / gist:c21c9a443d14ac93f2993267c884c07f
Created October 31, 2017 17:01
Enable AddPath() multipath (dirty snippet...)
package main
import (
"fmt"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/gobgp/cmd"
"github.com/osrg/gobgp/packet/bgp"
gobgp "github.com/osrg/gobgp/server"
"github.com/osrg/gobgp/table"
@nnao45
nnao45 / gist:a94c986684780cbdab8caff5f9bf538f
Last active October 31, 2017 15:56
AddPath() in multi path args.
package main
import (
"fmt"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/gobgp/cmd"
"github.com/osrg/gobgp/packet/bgp"
gobgp "github.com/osrg/gobgp/server"
"github.com/osrg/gobgp/table"