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
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 / 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
@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 / 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 / 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'){
curl -H "Content-type:on:key=<SERVER KEY in Cloud Message Setting Tab on Firebase Console>" -X POST -d
'{ "to": "/topics/topic-name",
"notification": {
"title": "notification title",
"text" : "notification text"
"click_action" : "action or activity name to open intent"
},
"data": {
"message": "this data message",
"title" : "this data message title",
------------------------------------------------------------------------
| NAME | Density | Pixels | 1/2 Square | 16:9 Image | Map Marker |
------------------------------------------------------------------------
| ldpi | 0.5 | 180 x 320 | | | |
| mdpi | 1 | 360 x 640 | 180x180 | 360 x 202 | 32 |
| hdpi | 1.5 | 540 x 960 | 270x270 | 540 x 304 | 48 |
| xhdpi | 2 | 720 x 1280 | 360x360 | 720 x 405 | 64 |
| xxhdpi | 3 | 1080 x 1920 | 540x540 | 1080 x 608 | 96 |
|xxxhdpi | 4 | 1440 x 2560 | | 1440 x 810 | |
@moehandi
moehandi / golang-tls.md
Created December 13, 2016 02:40 — 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
@moehandi
moehandi / client.go
Created December 13, 2016 02:39 — forked from spikebike/client.go
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@moehandi
moehandi / multiple_ssh_setting.md
Created December 2, 2016 16:20 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"