Skip to content

Instantly share code, notes, and snippets.

@xXPhenomXx
xXPhenomXx / golang_setup
Last active November 4, 2018 14:09
Go Setup on Ubuntu & Revel
** To install Golang on Ubuntu 17.xx server **
sudo add-apt-repository ppa:gophers/archive
sudo apt-get update
sudo apt-get install golang-1.9-go
export PATH=$PATH:/usr/lib/go-1.9/bin
go version (To verify its mapped correctly, should see something like: go version go1.9.2 linux/amd64)
* make a directory for your go applications, I use /home/apps/go
export GOPATH=/home/apps/go
(Now from inside your /home/apps/go folder you can start creating your go apps)
@xXPhenomXx
xXPhenomXx / time_format.go
Created February 18, 2018 21:45 — forked from ik5/time_format.go
A full example of all possible time formats in Golang
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println("Times: ")
t := time.Now()
@xXPhenomXx
xXPhenomXx / GoMgoSample-1.go
Created March 8, 2018 15:17 — forked from 345161974/GoMgoSample-1.go
Sample Go and MGO example
type (
// BuoyCondition contains information for an individual station.
BuoyCondition struct {
WindSpeed float64 `bson:"wind_speed_milehour"`
WindDirection int `bson:"wind_direction_degnorth"`
WindGust float64 `bson:"gust_wind_speed_milehour"`
}
// BuoyLocation contains the buoy's location.
BuoyLocation struct {
<select class="form-control" data-placeholder="Choose a Category" tabindex="1" :selected="sState" v-model="state">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CT">Connecticut</option>
@xXPhenomXx
xXPhenomXx / nginx-tls.conf
Created June 14, 2018 18:16 — forked from gavinhungry/nginx-tls.conf
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <[email protected]>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are omitted here.
#
# Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
#
@xXPhenomXx
xXPhenomXx / server.conf
Created June 14, 2018 18:16 — forked from timcheadle/server.conf
SSL nginx config example
server {
listen 80;
server_name www.example.com example.com;
# Redirect all traffic to SSL
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443 ssl default_server;
@xXPhenomXx
xXPhenomXx / README-Template.md
Created June 19, 2018 14:41 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@xXPhenomXx
xXPhenomXx / utc_to_cst.go
Created July 11, 2019 20:15
Convert UTC time to CST in Golang
// Handle UTC to CST conversion
loc, _ := time.LoadLocation("America/Chicago")
if err != nil {
fmt.Println(err)
}
dateAdded = dateAdded.In(loc)
p.DateAdded = dateAdded.Format("01/02/2006 03:04:05 PM")
@xXPhenomXx
xXPhenomXx / utc_to_cst.go
Created July 11, 2019 20:15
Convert UTC time to CST in Golang
// Handle UTC to CST conversion
loc, _ := time.LoadLocation("America/Chicago")
if err != nil {
fmt.Println(err)
}
dateAdded = dateAdded.In(loc)
p.DateAdded = dateAdded.Format("01/02/2006 03:04:05 PM")
package main
import (
"fmt"
"time"
"strings"
)
func main() {