Skip to content

Instantly share code, notes, and snippets.

View bxcodec's full-sized avatar
:octocat:
Learning and Making

Iman Tumorang bxcodec

:octocat:
Learning and Making
View GitHub Profile
@bxcodec
bxcodec / docker-rm-images.md
Created December 24, 2018 12:48 — forked from alferov/docker-rm-images.md
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")

References:

@bxcodec
bxcodec / gist:92201e2035a1d580b251fcafad1721bf
Created December 21, 2018 14:22 — forked from jaredhirsch/gist:4963424
ETags & If-None-Match headers: a dialogue

ETags & If-None-Match headers: a dialogue

1st request.

browser: can haz foo?

GET /foo HTTP/1.1

1st response.

@bxcodec
bxcodec / pr.md
Created November 22, 2018 04:31 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@bxcodec
bxcodec / gist:7790c6017e16595ea59e821c2bfe4545
Created September 27, 2018 10:02 — forked from justincase/gist:5492212
Enable mgo debug log
mgo.SetDebug(true)
var aLogger *log.Logger
aLogger = log.New(os.Stderr, "", log.LstdFlags)
mgo.SetLogger(aLogger)
@bxcodec
bxcodec / golang-prettyurl.go
Created August 7, 2017 03:35 — forked from techslides/golang-prettyurl.go
Generating Pretty Urls for SEO in GoLang using string and regex packages
type Post struct {
// db tag lets you specify the column name if it differs from the struct field
Id int64 `db:"post_id"`
Created int64
Title string `form:"Title" binding:"required"`
Body string `form:"Body"`
UserId int64 `form:"UserId"`
Url string
}
@bxcodec
bxcodec / flatbuffers-vector.go
Created June 5, 2017 08:54 — forked from mish15/flatbuffers-vector.go
flatbuffers pack nested vector
func (term *Term) Encode(version string) []byte {
builder := flatbuffers.NewBuilder(0)
// Preprocess the shotguns
shotguns := make([]flatbuffers.UOffsetT, len(term.Shotgun))
shotgunStrs := make([]flatbuffers.UOffsetT, len(term.Shotgun))
for i := 0; i < len(term.Shotgun); i++ {
shotgunStrs[i] = builder.CreateString(term.Shotgun[i].Term)
}
for i := 0; i < len(term.Shotgun); i++ {
@bxcodec
bxcodec / Container.go
Created June 5, 2017 07:44 — forked from urakozz/Container.go
Flat Buffers with Golang
// automatically generated, do not modify
package encoder
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type Container struct {
_tab flatbuffers.Table
}