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())) { |
wget https://github.com/git/git/archive/v2.10.2.zip | |
apt-get install make unzip gcc autoconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev | |
unzip v2.10.2.zip | |
cd git-2.10.2 | |
make configure | |
./configure --prefix=/usr/local | |
make install | |
git --version |
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 | |
if [ $# -ne 1 ] | |
then | |
echo "Performs a number of encodings on the first argument string" | |
echo "Usage: `basename $0` {string}" | |
exit 1 | |
fi | |
printf "n# String Scrambles:n" |
#!/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 |