Skip to content

Instantly share code, notes, and snippets.

View p4tin's full-sized avatar
💭
GO GO GO!!!

Paul Fortin p4tin

💭
GO GO GO!!!
View GitHub Profile
@p4tin
p4tin / proxy.go
Last active February 24, 2018 03:07
Proxying a request to a backend
package main
import (
"net/http"
"net/http/httputil"
"net/url"
"github.com/gorilla/mux"
)
@p4tin
p4tin / README.md
Last active June 21, 2018 01:11
Calling GO from python

After compiling libadd.go (with the command: "go build -buildmode=c-shared -o libadd.so libadd.go", it will have created 2 files (a libadd.so and libadd.h), the libadd.so is the shared library to call from python as shown in call_lib.h

@p4tin
p4tin / rotate_and_match.go
Created June 21, 2018 03:51
Find words that have the same letters in a list
package main
import (
"fmt"
"strings"
)
func rotate(a []byte, i int) {
for count := 1; count <= i; count++ {
tmp := a[0]
@p4tin
p4tin / Dockerfile
Created July 1, 2018 14:47
Capturing docker stop in a golang application (no need for S6!!)
from alpine:latest
COPY main /
CMD [ "./main" ]
@p4tin
p4tin / simple_dep_injection_test.go
Last active July 9, 2018 01:41
Simple dependancy Injection example
package main
import (
"fmt"
"testing"
)
var ScreenPrint = fmt.Printf
func Greet(name string) {
@p4tin
p4tin / clients-mongo,go
Created July 12, 2018 02:18
Mocking Mongo
package clients
import (
"github.com/globalsign/mgo"
"testapp"
)
// NewSession returns a new Mongo Session.
func NewSession() testapp.Session {
mgoSession, err := mgo.Dial("localhost:27017")
package main
import (
"strings"
"net/http"
"fmt"
"time"
"io/ioutil"
"net/url"
)
@p4tin
p4tin / sqsmv.go
Created August 16, 2018 16:01
Copy messages from one AWS Queue to another
package main
import (
"flag"
"fmt"
"log"
"os"
"sync"
"github.com/aws/aws-sdk-go/aws"
@p4tin
p4tin / invoke_lambda.go
Created November 28, 2018 17:39
Invoke Lamdba in your local for testing
package golambdainvoke
import (
"encoding/json"
"errors"
"fmt"
"net/rpc"
"time"
"github.com/aws/aws-lambda-go/lambda/messages"
@p4tin
p4tin / README.md
Created November 30, 2018 16:18
Wordpress Kubernetes Cluster

Kubernetes Wordpress installation

Use minikube to test with

  • on macos: ** brew cask install minikube ** minikube start

Start the cluster and scale:

  • kubectl create secret generic mysql-pass --from-literal=password=YOUR_PASSWORD