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:
@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 / log.go
Created November 10, 2017 20:50 — forked from cespare/log.go
Golang apache logging
type ApacheLogRecord struct {
http.ResponseWriter
ip string
time time.Time
method, uri, protocol string
status int
responseBytes int64
elapsedTime time.Duration
}
@blinkinglight
blinkinglight / reflection.go
Created November 16, 2017 09:34 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@blinkinglight
blinkinglight / ordered_parallel.go
Created April 14, 2018 09:12 — forked from marianogappa/ordered_parallel.go
Parallel processing with ordered output in Go
/*
Parallel processing with ordered output in Go
(you can use this pattern by importing https://github.com/MarianoGappa/parseq)
This example implementation is useful when the following 3 conditions are true:
1) the rate of input is higher than the rate of output on the system (i.e. it queues up)
2) the processing of input can be parallelised, and overall throughput increases by doing so
3) the order of output of the system needs to respect order of input
- if 1 is false, KISS!
@blinkinglight
blinkinglight / backpressure.go
Created April 14, 2018 09:12 — forked from marianogappa/backpressure.go
Example backpressure implementation in Go
/*
This snippet is an example of backpressure implementation in Go.
It doesn't run in Go Playground, because it starts an HTTP Server.
The example starts an HTTP server and sends multiple requests to it. The server starts denying
requests by replying an "X" (i.e. a 502) when its buffered channel reaches capacity.
This is not the same as rate-limiting; you might be interested in https://github.com/juju/ratelimit
or https://godoc.org/golang.org/x/time/rate.
@blinkinglight
blinkinglight / golang-linked-list.go
Created July 11, 2018 04:31 — forked from maksadbek/golang-linked-list.go
golang linked list implementation
package main
import "fmt"
type Node struct {
prev *Node
next *Node
key interface{}
}