This file contains hidden or 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 hidden or 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
| { | |
| "containers": [{ | |
| "path": "pathA", | |
| "components": [{ | |
| "image": "Image1", | |
| "name": "Name1" | |
| }] | |
| }, | |
| { | |
| "path": "pathB", |
This file contains hidden or 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 hidden or 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 ( | |
| "encoding/json" | |
| "fmt" | |
| "log" | |
| "time" | |
| ) | |
| // Fulldata - test |
This file contains hidden or 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
| apiVersion: v1 | |
| kind: Config | |
| clusters: | |
| {{- if eq (env "KUBE_ENVIRONMENT") "pr-kops" "pr" }} | |
| {{- with secret (printf "secret/jenkins/kubernetes/%s" (env "KUBE_ENVIRONMENT"))}} | |
| - cluster: | |
| api-version: v1 | |
| server: "{{ .Data.api }}" | |
| {{- if .Data.token}} | |
| insecure-skip-tls-verify: true |
This file contains hidden or 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
| abcs = ['a', 'b', 'c'] | |
| node('master') { | |
| stage('Test 1: loop of echo statements') { | |
| echo_all(abcs) | |
| } | |
| stage('Test 2: loop of sh commands') { | |
| loop_of_sh(abcs) | |
| } | |
| stage('Test 3: loop with preceding SH') { |
This file contains hidden or 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" | |
| import "sync" | |
| func main() { | |
| var wg sync.WaitGroup | |
| count := 10 | |
| wg.Add(count) |
This file contains hidden or 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 | |
| ( set -o posix ; set ) > vars | |
| sed -i '/BASHOPTS/d' vars | |
| sed -i '/BASH_VERSINFO/d' vars | |
| sed -i '/EUID/d' vars | |
| sed -i '/PPID/d' vars | |
| sed -i '/SHELLOPTS/d' vars | |
| sed -i '/UID/d' vars |
This file contains hidden or 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/zsh | |
| #### Uses the-silver-surfer (ag) and zsh | |
| touch rotatelogdone.txt | |
| ag -L logRotator --nocolor | xargs ls -1 > rotatelogdone.txt | |
| ARRAY=($(cat rotatelogdone.txt)) | |
| for VAR in ${ARRAY[@]} |
This file contains hidden or 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
| { | |
| /* | |
| //Please click VSCode -> Preferences -> User Snippets -> groovy | |
| //Then copy and paste this into groovy.json | |
| */ | |
| /* | |
| // Place your snippets for Groovy here. Each snippet is defined under a snippet name and has a prefix, body and | |
| // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: |