Skip to content

Instantly share code, notes, and snippets.

View blinkinglight's full-sized avatar
🏠
Working from home

M blinkinglight

🏠
Working from home
View GitHub Profile
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
package main
import (
"fmt"
"github.com/tuxychandru/pubsub"
"time"
)
type Event struct {
Command string
package main
type Event struct {
Command string
Payload interface{}
}
type EventMananger struct {
eventsChan chan *Event
events map[string]func(interface{})
@blinkinglight
blinkinglight / 0_reuse_code.js
Created July 18, 2016 12:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@blinkinglight
blinkinglight / golang_job_queue.md
Created September 4, 2016 17:03 — forked from harlow/golang_job_queue.md
Job queues in Golang
@blinkinglight
blinkinglight / ipcalc.go
Created September 23, 2016 17:48 — forked from kotakanbe/ipcalc.go
get all IP address from CIDR in golang
package main
import (
"net"
"os/exec"
"github.com/k0kubun/pp"
)
func Hosts(cidr string) ([]string, error) {
@blinkinglight
blinkinglight / golang-tls.md
Created October 1, 2016 12:42 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@blinkinglight
blinkinglight / gist:cc139d69669fd509363ea90eff54e02b
Last active December 9, 2021 03:06
golang http context example
package main
import (
"context"
"fmt"
"github.com/nats-io/nuid"
"log"
"net/http"
)
@blinkinglight
blinkinglight / http buffered cache.go
Created November 5, 2017 13:10
http buffed restream cache
package main
import (
"fmt"
"io"
"net/http"
"runtime"
"sync"
"time"
)
@blinkinglight
blinkinglight / master-slave-election.go
Created November 5, 2017 15:45
golang master slave election
package main
import (
"flag"
"fmt"
"github.com/nats-io/go-nats"
"strconv"
"strings"
"sync"
"time"