Skip to content

Instantly share code, notes, and snippets.

View moehandi's full-sized avatar
:octocat:

M. Andi Saputra moehandi

:octocat:
  • Jakarta, Indonesia
View GitHub Profile
@moehandi
moehandi / Android jwplayer conflict with play-services-ads
Created January 24, 2017 01:58
Gradle settings for Android jwplayer conflict with play-services-ads
compile ('com.longtailvideo.jwplayer:jwplayer-core:2.6.2+12'){
}
compile ('com.longtailvideo.jwplayer:jwplayer-common:2.6.2+12') {
exclude module: 'appcompat-v7'
}
compile ('com.longtailvideo.jwplayer:jwplayer-ima:2.6.2+12') {
exclude group: 'com.google.android.gms'
exclude module: 'play-services-ads'
}
compile ('com.longtailvideo.jwplayer:jwplayer-chromecast:2.6.2+12'){
@moehandi
moehandi / tmux.md
Created February 24, 2017 07:36 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@moehandi
moehandi / redirectExample.go
Created March 18, 2017 01:42 — forked from d-schmidt/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
"log"
)
func redirect(w http.ResponseWriter, req *http.Request) {
// remove/add not default ports from req.Host
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
@moehandi
moehandi / CommandLineCV.go
Created March 29, 2017 19:14
CommandLineCV
////////////////////////////////////////////////////////////////////////////
// Porgram: CommandLineCV
// Purpose: Go commandline via cobra & viper demo
// Authors: Tong Sun (c) 2015, All rights reserved
// based on https://github.com/chop-dbhi/origins-dispatch/blob/master/main.go
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Program start
db.createUser({ user: "campaigns", pwd: "password", roles: [{ role: "dbOwner", db: "campaigns"},{role:"readWrite",db: "campaigns"},{role: "dbAdmin",db: "campaigns"},{role:"userAdmin",db:"campaigns"} ] })
Successfully added user: {
"user" : "campaigns",
"roles" : [
{
"role" : "dbOwner",
"db" : "campaigns"
},
{
"role" : "readWrite",
@moehandi
moehandi / golang-nuts.go
Created April 14, 2017 06:32 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@moehandi
moehandi / .Title
Created April 22, 2017 18:47 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@moehandi
moehandi / main.go
Created April 23, 2017 02:13 — forked from Paulius-Maruska/main.go
Understanding http request routing with net/http and gorilla/mux.
package main
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
)
func handler(name string)func (http.ResponseWriter, *http.Request) {
dummyHandler := func (w http.ResponseWriter, r *http.Request) {
@moehandi
moehandi / negroni-gorilla.go
Created April 23, 2017 02:30 — forked from danesparza/negroni-gorilla.go
Negroni with Gorilla mux subrouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"log"
"net/http"
)
@moehandi
moehandi / time_tracer.go
Created April 24, 2017 16:11
function for tracking time used by function
package main
import (
"time"
"fmt"
"log"
"runtime"
"github.com/fatih/color"
)