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 / text_adv-part-1.go
Last active February 29, 2024 18:59
Writing a Text Adventure Game in Go - Part 1
package main
import (
"fmt"
"math/rand"
"time"
)
type Game struct {
Welcome string
@p4tin
p4tin / handlers_test.go
Created March 22, 2016 17:27
Testing Http Handlers in GO
package main
import (
"net/http"
"testing"
"net/http/httptest"
)
func TestHealthCheckHandler(t *testing.T) {
// Create a request to pass to our handler. We don't have any query parameters for now, so we'll
@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
@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 / sqsQueueUtil.go
Last active August 1, 2022 03:45
Simple Utility to access Amazon SQS (or local ElasticMQ) using Go
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sqs"
"os"
"flag"
)
@p4tin
p4tin / groktunnel.go
Last active April 5, 2022 20:12
groktunnel
package main
import (
"bufio"
"context"
"crypto/rand"
"flag"
"fmt"
"io"
"log"
@p4tin
p4tin / Mongo.go
Created December 13, 2015 18:06
Golang Mongo CRUD Example
package mongo
import (
"time"
"log"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
// Profile - is the memory representation of one user profile
@p4tin
p4tin / main.py
Created October 3, 2020 15:17
Json Encode/Decode Python classes
import json
from json import JSONEncoder
class Student:
def __init__(self, first_name, last_name):
self._first_name = first_name
self._last_name = last_name
@property
@p4tin
p4tin / main.go
Created July 2, 2020 01:44
Create, Shuffle and Deal Deck of cards
package main
import (
"fmt"
"math/rand"
"os"
"time"
)
// Card holds the card suits and types in the deck
package main
import (
"fmt"
"math/rand"
"os"
"sort"
"time"
)