This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
intslice := [][]int{[]int{1}, []int{2}} | |
// Grow | |
for index, value := range intslice { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"gopkg.in/src-d/go-git.v4/plumbing" | |
"gopkg.in/src-d/go-git.v4" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
var ( | |
word = "test" | |
reversedstringarray []string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func removeDuplicates(elements []string) []string { // change string to int here if required | |
// Use map to record duplicates as we find them. | |
encountered := map[string]bool{} // change string to int here if required | |
result := []string{} // change string to int here if required | |
for v := range elements { | |
if encountered[elements[v]] == true { | |
// Do not add duplicate. | |
} else { | |
// Record this element as an encountered element. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab( 'com.ecwid.consul:consul-api:1.2.4' ) | |
import com.ecwid.consul.v1.* | |
client = new ConsulClient("172.20.20.10:8500") | |
setvalue("Abskey", "Absvalue") | |
println getvalue("Abskey") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "subnets" { | |
type = list(any) | |
default = ["subnet-a", "subnet-b", "subnet-c"] | |
} | |
variable "instances" { | |
default = { | |
TEST1 = { | |
sg = ["example1"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
virtual_machines = { | |
"test-services1" = { | |
vm_instance_group = "instance-group-services" | |
}, | |
"test-services2" = { | |
vm_instance_group = "instance-group-services" | |
}, | |
"test-cpu" = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:stretch-slim | |
RUN apt-get update -y && apt install -y curl && \ | |
curl -LO https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/containerd.io_1.2.6-3_amd64.deb && apt install -f -y ./containerd.io_1.2.6-3_amd64.deb && \ | |
curl -LO https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/docker-ce-cli_18.09.7~3-0~debian-stretch_amd64.deb && apt install -f -y ./docker-ce-cli_18.09.7~3-0~debian-stretch_amd64.deb && \ | |
curl -LO https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/docker-ce_18.09.7~3-0~debian-stretch_amd64.deb && apt install -f -y ./docker-ce_18.09.7~3-0~debian-stretch_amd64.deb && \ | |
rm -rf *.deb | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Copyright (c) 2013 Nyr. Released under the MIT License. | |
# Copyright (c) 2019 Fabrice Triboix | |
set -eu | |
################### | |
# Parse arguments # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tfinit () { | |
if [ -z "${1}" ]; then | |
terraform init | |
else | |
terraform init -backend-config=${1} | |
fi | |
} | |
function tfplan () { | |
if [ -z "${1}" ]; then |