Skip to content

Instantly share code, notes, and snippets.

View sonyarianto's full-sized avatar
🙏
Keep learning, stay relevant, relevancy increases value.

Sony AK sonyarianto

🙏
Keep learning, stay relevant, relevancy increases value.
View GitHub Profile
@sonyarianto
sonyarianto / Setting up a SSL Certificate from Comodo.md
Last active August 9, 2017 02:46
Setting up a SSL Certificate from Comodo

Setting up a SSL Certificate from Comodo

I bought SSL Certs from DomainEsia.com and they resale SSL Certs from Comodo http://www.comodo.com/

These are the steps I went through to set up an SSL cert.

Purchase the certificate

@sonyarianto
sonyarianto / How to copy folder with subdirectories in Linux.md
Last active August 9, 2017 04:48
How to copy folder with subdirectories in Linux.md

How to copy folder with subdirectories in Linux

Copy from /home/source/data to /home/target/folder even the /home/target/folder is not exists.

cp -avr /home/source/data /home/target/folder
@sonyarianto
sonyarianto / Simple query MongoDB with Go (Part 1).md
Last active November 27, 2018 09:02
Simple query MongoDB with Go (Part 1)

MongoDB Data

[{
    "title" : "Hello World",
    "slug" : "hello-world",
    "short_description" : "Hello World is the standard ritual for us when learning new programming language. It's good for you mind and soul hahaha!",
    "tags" : [ 
        {
            "tag" : "beginner"
        }, 
@sonyarianto
sonyarianto / hello-world.go
Created December 5, 2018 09:34
Hello World
package main
import "fmt"
func main() {
fmt.Println("hello, world")
}
@sonyarianto
sonyarianto / hello-world-on-web.go
Created December 5, 2018 09:36
Hello World on web
package main
import (
"io"
"log"
"net/http"
)
func Default(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
@sonyarianto
sonyarianto / hello-world-on-web-2.go
Created December 5, 2018 09:37
Hello World on web 2
package main
import (
"io"
"log"
"net/http"
)
func Default(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
@sonyarianto
sonyarianto / my-text-file.txt
Created December 5, 2018 09:38
Sample of text file
Dear Go designers,
I love using Go because it's easy to use and easy to deploy.
I hope Go will become very popular language in the future.
Best regards,
Sony AK
[email protected]
@sonyarianto
sonyarianto / load-a-text-file.go
Created December 5, 2018 09:39
Load a text file
package main
import (
"fmt"
"io/ioutil"
"log"
)
func main() {
fileContent, err := ioutil.ReadFile("my-text-file.txt")
@sonyarianto
sonyarianto / web-routing-default-mux.go
Created December 5, 2018 09:40
Web routing with default mux (net/http)
package main
import (
"io"
"log"
"net/http"
)
func serviceDefault(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
@sonyarianto
sonyarianto / web-routing-gorilla-mux.go
Created December 5, 2018 09:41
Web routing with gorilla/mux
package main
import (
"fmt"
"github.com/gorilla/mux"
"log"
"net/http"
)
func Home(w http.ResponseWriter, r *http.Request) {