Skip to content

Instantly share code, notes, and snippets.

View thedevsaddam's full-sized avatar
🏴‍☠️
Wherever we want to go, we'll go!

Saddam H thedevsaddam

🏴‍☠️
Wherever we want to go, we'll go!
View GitHub Profile
mysql:
image: mysql
container_name: database
ports:
- 3306:3306
environment:
MYSQL_DATABASE: laravel
MYSQL_ROOT_PASSWORD: 123456
php:
@thedevsaddam
thedevsaddam / jwt.go
Created August 8, 2017 19:27 — forked from troyk/jwt.go
golang jwt example
package cmd
import (
"encoding/json"
"flag"
"fmt"
"os"
"regexp"
"strings"
@thedevsaddam
thedevsaddam / 1_simple.go
Created August 9, 2017 11:26 — forked from sosedoff/1_simple.go
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@thedevsaddam
thedevsaddam / main.go
Created August 9, 2017 15:53 — forked from chadlung/main.go
An example Go (golang) REST service that uses JWT (JSON Web Tokens) and Negroni http://www.giantflyingsaucer.com/blog/?p=5994
package main
// Generate RSA signing files via shell (adjust as needed):
//
// $ openssl genrsa -out app.rsa 1024
// $ openssl rsa -in app.rsa -pubout > app.rsa.pub
//
// Code borrowed and modified from the following sources:
// https://www.youtube.com/watch?v=dgJFeqeXVKw
// https://goo.gl/ofVjK4
@thedevsaddam
thedevsaddam / .Title
Created August 13, 2017 15:11 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@thedevsaddam
thedevsaddam / mongodb_lookup.go
Created August 13, 2017 15:11 — forked from sindbach/mongodb_lookup.go
A simple example of how to use $lookup in Golang using mgo.
package main
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
func main() {
session, err := mgo.Dial("localhost")
if err != nil {
@thedevsaddam
thedevsaddam / context_in_struct.go
Created August 17, 2017 17:49 — forked from cep21/context_in_struct.go
Example of context with message passing
package main
import "fmt"
import "golang.org/x/net/context"
// A message processes parameter and returns the result on responseChan.
// ctx is places in a struct, but this is ok to do.
type message struct {
responseChan chan<- int
parameter string
@thedevsaddam
thedevsaddam / submit.md
Created September 15, 2017 17:09 — forked from tanaikech/submit.md
Exporting Project on Google Drive using Golang Quickstart

Exporting Project on Google Drive using Golang Quickstart

This is a sample script for exporting a project on Google Drive to local PC using Golang Quickstart. A file with refresh token is saved to the same directory with this script as go-quickstart.json. Before you run this script, please enable Drive API on your Google API console.

Points for exporting project

  1. In order to export project, both drive.DriveScriptsScope and drive.DriveScope have to be included in the scope.
  2. The mimeType for exporting has to be "application/vnd.google-apps.script+json".

If you already have the file with refresh token, at first, please delete it and run this script. By this, the scopes of refresh token and access token are updated.

Script :

@thedevsaddam
thedevsaddam / google_drive_create_file_example.go
Created September 15, 2017 17:09 — forked from atotto/google_drive_create_file_example.go
google drive example (v3 create file)
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@thedevsaddam
thedevsaddam / uploader.go
Created September 15, 2017 17:09 — forked from TheGU/uploader.go
Golang to upload file to google drive with progress bar using Google API
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"