Skip to content

Instantly share code, notes, and snippets.

@mohae
mohae / gist:a291b2d8a9065df02dcc
Created January 31, 2016 23:45
simple see if element exists examples in Go
package main
import (
"fmt"
"sort"
)
func main() {
// value for which to search
word := "b"
#!/bin/bash
# For more info see https://golang.org/doc/install.html, the instructions there are all
# that is needed to install Go.
#
# DO NOT RUN with SUDO; Go should be installed under the user not root. Using sudo will
# cause problems. This script will install Go to /usr/local/go and create your workspace
# in your home directory: $HOME/go.
#
# The workspace is where all of the Go code will exist. Place your code in a subdirectory
# of $HOME/go/src. If you want your Go code (workspace) in a different location, change
PS D:\packer-templates\centos7-64-vbox-vagrant> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'centos7-64-vbox-vagrant.box' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'centos7-64-vbox-vagrant.box' (v0) for provider: virtualbox
default: Unpacking necessary files from: file://D:/packer-templates/centos7-64-vbox-vagrant/centos7-64-vbox-vagrant.box
default: Progress: 100% (Rate: 68.9M/s, Estimated time remaining: --:--:--)
==> default: Successfully added box 'centos7-64-vbox-vagrant.box' (v0) for 'virtualbox'!
Usage:
VBoxManage modifyvm <uuid|vmname>
[--name <name>]
[--groups <group>, ...]
[--description <desc>]
[--ostype <ostype>]
[--iconfile <filename>]
[--memory <memorysize in MB>]
package main
import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
)
@mohae
mohae / InstallGo
Last active February 23, 2016 22:24
Installs the current release of Go
#!/bin/bash
# For more info see https://golang.org/doc/install.html, the instructions there are all
# that is needed to install Go.
#
# DO NOT RUN with SUDO; Go should be installed under the user not root. Using sudo will
# cause problems. This script will install Go to /usr/local/go and create your workspace
# in your home directory: $HOME/go.
#
# The workspace is where all of the Go code will exist. Place your code in a subdirectory
# of $HOME/go/src. If you want your Go code (workspace) in a different location, change
#!/bin/bash
# For more info see https://golang.org/doc/install.html, the instructions there are all
# that is needed to install Go.
#
# DO NOT RUN with SUDO; Go should be installed under the user not root. Using sudo will
# cause problems. This script will install Go to /usr/local/go and create your workspace
# in your home directory: $HOME/go.
#
# The workspace is where all of the Go code will exist. Place your code in a subdirectory
# of $HOME/go/src. If you want your Go code (workspace) in a different location, change
@mohae
mohae / upgradeGo
Last active February 19, 2016 21:13
upgrades go to current version; removes prior version artifacts
#!/bin/bash
# remove the old Go
sudo rm -rf /usr/local/go
# remove artifacts from prior version
rm -rf $GOPATH/bin/*
rm -rf $GOPATH/pkg/*
# download and extract Go to /usr/local/go/
# change the tarball for different version/arch
wget -qO- https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz | sudo tar xz -C /usr/local
@mohae
mohae / InstallGo
Created February 24, 2016 00:41 — forked from ericlagergren/InstallGo
Installs the current release of Go
#!/bin/bash
#
# For more info see https://golang.org/doc/install.html, the instructions there are all
# that is needed to install Go.
#
# DO NOT RUN with sudo; Go should be installed under the user not root. Using sudo will
# cause problems.
set -euo pipefail
type Gamer struct {
Parameters `json:"parameters"`
Resource string `json:"resource"`
ResultSetss []ResultSets `json:"resultSets"`
}
type Parameters struct {
DayOffset string `json:"DayOffset"`
GameDate string `json:"GameDate"`
LeagueID string `json:"LeagueID"`