Skip to content

Instantly share code, notes, and snippets.

Joseph Spurrier josephspurrier

Block or report user

Report or block josephspurrier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@josephspurrier
josephspurrier / etc-init.d-hello-world
Last active Oct 19, 2019
/etc/init.d Script for Go Application
View etc-init.d-hello-world
#!/bin/bash
#
# chkconfig: 35 95 05
# description: Hello world application.
# Run at startup: sudo chkconfig hello-world on
# Load functions from library
. /etc/init.d/functions
@josephspurrier
josephspurrier / values_pointers.go
Last active Oct 8, 2019
Golang - Asterisk and Ampersand Cheatsheet
View values_pointers.go
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@josephspurrier
josephspurrier / openswan-aws.md
Last active Sep 22, 2019
Set up VGW on AWS with OpenSwan
View openswan-aws.md

Set up VGW on AWS with OpenSwan

You will need 2 VPCs. The Internet VPC will have the Internet Gateway and the OpenSwan EC2 instance. The Project VPC will have your application or Kubernetes cluster.

Internet VPC

  • VPC CIDR: 10.230.30.0/24
  • Private Subnet: 10.230.30.128/25 - Route Table with 0.0.0.0/0 to NAT
  • Public Subnet: 10.230.30.0/25 - Route Table with 0.0.0.0/0 to IGW, 10.224.36.0/23 to OpenSwan Instance
  • NAT Gateway in the public subnet with an IP of 52.15.61.171
@josephspurrier
josephspurrier / structs_interface.go
Last active Sep 7, 2019
Golang - Understand Structs and Interfaces
View structs_interface.go
// Also available at: https://play.golang.org/p/yTTpB5gB6C
package main
import (
"fmt"
)
// *****************************************************************************
// Example 1 - Struct vs Struct with Embedded Type
@josephspurrier
josephspurrier / drop_encrypt.go
Last active Aug 8, 2019
Golang - Drag and Drop AES Encryption and Decryption
View drop_encrypt.go
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"os"
@josephspurrier
josephspurrier / gitlab_private_api.go
Created Jul 30, 2019
GitLab Private API for Reading Issue Order in a List
View gitlab_private_api.go
// Package main is an example of how to use the GitLab private API.
// Related: https://gitlab.com/gitlab-org/gitlab-ce/issues/43674
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
@josephspurrier
josephspurrier / addimport.go
Last active Jul 28, 2019
Add Import using ast in Go
View addimport.go
// Source: https://gitlab.pro/googlesource/tools/blob/ae534bcb6ccdd13487d0491c2194d10ebcd30ff3/astutil/imports.go
// Source: https://golang.org/src/go/doc/example.go#L262
package main
import (
"bytes"
"fmt"
"go/ast"
"go/parser"
View sshclient.go
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@josephspurrier
josephspurrier / sshremote.go
Last active Jun 21, 2019
Golang Remote Execution
View sshremote.go
package main
/*
// Example
sci := ServerConnInfo{
"127.0.0.1",
"22",
"ubuntu",
`key.pem`,
}
@josephspurrier
josephspurrier / loadCSV.php
Last active Jun 12, 2019
Parse a CSV file in PHP, remove hidden characters, escape fields to prepare for MySQL, and return an associative array.
View loadCSV.php
// Auto detect line endings
ini_set('auto_detect_line_endings', true);
function loadCSV($file)
{
// Create an array to hold the data
$arrData = array();
// Create a variable to hold the header information
$header = NULL;
You can’t perform that action at this time.