The newer versions of bash include a regex operator =~
Simple example
$ re='t(es)t'
$ [[ "test" =~ $re ]]
$ echo $?
0
$ echo ${BASH_REMATCH[1]}
es
| import java.net.http.*; | |
| var client = HttpClient.newHttpClient(); | |
| var uri = new URI("https://riimusolutions.com"); | |
| var request = HttpRequest.newBuilder().uri(uri).build(); | |
| var response = client.send(request, HttpResponse.BodyHandlers.ofString()); | |
| System.out.println(response.body()); | |
| /exit |
| #!/bin/bash | |
| # thanks to Niels de Vos (https://gist.github.com/nixpanic/5460521), this script | |
| # is based on his one | |
| RED='\033[1;31m' | |
| GREEN='\033[1;32m' | |
| NC='\033[0m' # No Color |
| def versions = [] | |
| def f = new File('mock-version-tags.txt') | |
| f.eachLine { versions << it } | |
| def versionComparator = { a, b -> | |
| def VALID_TOKENS = /._/ | |
| a = a.tokenize(VALID_TOKENS) | |
| b = b.tokenize(VALID_TOKENS) | |
| for (i in 0..<Math.max(a.size(), b.size())) { |
The newer versions of bash include a regex operator =~
Simple example
$ re='t(es)t'
$ [[ "test" =~ $re ]]
$ echo $?
0
$ echo ${BASH_REMATCH[1]}
es
| # check if job exists | |
| curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken | |
| # with folder plugin | |
| curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken | |
| # without folder plugin | |
| curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken | |
| # create folder |
| # Docker Machine for Consul | |
| docker-machine \ | |
| create \ | |
| -d virtualbox \ | |
| consul-machine | |
| # Start Consul | |
| docker $(docker-machine config consul-machine) run -d --restart=always \ | |
| -p "8500:8500" \ | |
| -h "consul" \ |
| def writer = new FileWriter('sample2.xml') | |
| // Define 2 tables | |
| def tables =[] | |
| def dept = new Table(tableName:'departments') | |
| dept.columns << new Column(name:'id', type:'number(4,0)', nullable:false) | |
| dept.columns << new Column(name:'dname', type:'varchar2(14)', remarks:'Department name') | |
| tables << dept | |
| def emp = new Table(tableName:'employees', remarks:'All employees known in HR system') |
| #!/bin/bash | |
| # Bash shell script for generating self-signed certs. Run this in a folder, as it | |
| # generates a few files. Large portions of this script were taken from the | |
| # following artcile: | |
| # | |
| # http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html | |
| # | |
| # Additional alterations by: Brad Landers | |
| # Date: 2012-01-27 |
| #!/bin/sh | |
| # Sublime Text 3 install with Package Control | |
| # http://simonewebdesign.it/install-sublime-text-3-on-linux/ | |
| # Run this script with: | |
| # $ curl -L git.io/sublimetext | sh | |
| # Detect the architecture |
| input { | |
| file { | |
| type => "rodslog" | |
| start_position => beginning | |
| debug => true | |
| sincedb_path => "/root/logstash/.sincedb" | |
| path => [ "/root/logstash/logs/eu/var/log/irods/rodsLog.*" ] | |
| } | |
| } |