Skip to content

Instantly share code, notes, and snippets.

View Adron's full-sized avatar
🤘
GSD. Just ping me, I'll get back at ya.

Adron Hall Adron

🤘
GSD. Just ping me, I'll get back at ya.
View GitHub Profile
@Adron
Adron / Golang-Logger.go
Last active May 29, 2017 22:16
A basic logger for getting started.
package main
import (
"log"
"net/http"
"time"
)
func Logger(inner http.Handler, name string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@Adron
Adron / JSON-Data-Diluvium-Example.json
Last active May 29, 2017 22:16
Example data diluvium schema JSON. (Early example)
[
{
"schema": "relational",
"database": "postgresql",
"connection": [
{
"connectionData": "stringForConnectionEtc",
"username": "theUser",
"password": "thePassword",
"otherConnectionParam": "TheOtherValue"
@Adron
Adron / golang-hello-world-service.go
Created May 29, 2017 22:16
A Hello World Golang Service Example.
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@Adron
Adron / codeship-services.yaml
Created May 29, 2017 22:18
Service file example for Data Diluvium.
datadiluvium:
build:
image: golang
dockerfile_path: Dockerfile
@Adron
Adron / codeship-steps.yaml
Created May 29, 2017 22:18
Codeship steps example for Data Diluvium.
- name: sailing
service: datadiluvium
command: go clean
- name: sailing_tests
service: datadiluvium
command: go test .
- name: sailing_build
service: datadiluvium
command: go build
@Adron
Adron / Dockerfile
Created May 29, 2017 22:19
Dockerfile for Data Diluvium w/ Alpine base image.
FROM golang:1.7.4-alpine
ENV GOPATH /go
RUN mkdir /app && \
apk add --update curl && \
rm -rf /var/cache/apk/*
ADD . /app/
WORKDIR /app
@Adron
Adron / Go-hello-world-does-some-work.go
Created May 29, 2017 22:20
Go Hello World style app that does some actual processing.
package main
import (
"bytes"
"fmt"
"log"
"net/http"
)
func main() {
@Adron
Adron / routes.go
Created May 29, 2017 22:24
Creating a simple routes data structure to store routes in.
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
type Routes []Route
var routes = Routes{
Route{
@Adron
Adron / Newrouter-mux.go
Created May 29, 2017 22:28
Adding a new router & handler for mux for Data Diluvium Code.
func HandleThis(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Welcome!\n")
}
func NewRouter() *mux.Router {
router := mux.NewRouter().StrictSlash(true)
for _, route := range routes {
var handler http.Handler
@Adron
Adron / ssh-keygen.sh
Created June 22, 2017 07:31
ssh-keygen
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"