gitlab git mvn pull all clean all

Suppose you have a directory /pub/gitlab with all your git projects, but also a logs directory which can be skipped.

user@server:~$ cat > cleanall
cd /pub/gitlab
for d in */ ; do
log=$(basename $d)
[[ $log =~ ^(logs)$ ]] && continue
cd "$d"
echo -n "$d : "
mvn clean
cd ..
done

user@server:~$ cat > pullall
cd /pub/gitlab
for d in */ ; do
log=$(basename $d)
[[ $log =~ ^(logs)$ ]] && continue
cd "$d"
echo -n "$d : "
git pull
cd ..
done

Offline install sqlcmd (SQL Server command line tool) on Linux CentOS

To install sqlcmd on Linux CentOS try to get hold on the following rpm’s :

unixODBC from CentOS: http://mirror.centos.org/centos/7/os/x86_64/Packages/
file: unixODBC-2.3.1-14.el7.x86_64.rpm

msodbcsql from Microsoft: https://packages.microsoft.com/rhel/8/prod/
file: msodbcsql18-18.0.1.1-1.x86_64.rpm

mssql-tools from Microsoft: https://packages.microsoft.com/rhel/7.3/prod/
file: mssql-tools18-18.0.1.1-1.x86_64.rpm

Now run:
sudo yum localinstall unixODBC-2.3.1-14.el7.x86_64.rpm
sudo yum localinstall msodbcsql18-18.0.1.1-1.x86_64.rpm
sudo yum localinstall mssql-tools18-18.0.1.1-1.x86_64.rpm

Accept license when asked and you’re done hopefully . Add to the path (in .bashrc):
export PATH=/opt/mssql-tools18/bin:$PATH

If you’re behind a firewall and your database instance is on port nnnn

sudo iptables -A INPUT -p tcp --dport nnnn -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -p udp --dport nnnn -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

Now try:
sqlcmd -S tcp:[hostname],[port] -U [username] -P [password]
or
sqlcmd -C -S tcp:[hostname],[port] -U [username] -P [password]
like
sqlcmd -C -S tcp:some.address.com,50001 -U john -P doe

git deploy (to) empty repository on github

$ cd ../deploydemo/
$ git init
Initialized empty Git repository in C:/Dev/Projects/deploydemo/.git/
$ git add .
warning: LF will be replaced by CRLF in .gitignore.
$ git commit -m "initial commit"
[master (root-commit) 581ef49] initial commit
 17 files changed, 897 insertions(+)
git remote add origin https://github.com/username/deploydemo.git
$ git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/username/deploydemo.git'
$ git add .
$ git commit -m "initial commit"
On branch master
nothing to commit, working tree clean
$ git push origin master
Enumerating objects: 42, done.

changing git ssl to git https

git config –global –unset http.proxy

git config –global credential.helper “cache –timeout=36000”

git config –global credential.helper wincred

git remote -v

git remote set-url origin https://gitlab.server.com/prj/module.git

git pull

fatal: unable to access ‘https://gitlab.server.com/prj/module.git/’: SSL certificate problem: unable to get local issuer certificate

git config –global http.sslVerify false

Username for ‘https://gitlab.server.com’: username
Password for ‘https://username@gitlab.server.com’:
Already up-to-date.

Optional or orElse

What’s more elegant

Optional<Header> resultcode = Arrays.stream(response.getAllHeaders())
        .filter(h -> "X-Header-Result".equals(h.getName()))
        .findFirst();

return resultcode.isPresent() ? resultcode.get().getValue() : "";

Or

String resultcode = Arrays.stream(response.getAllHeaders())
        .filter(h -> "X-Header-Result".equals(h.getName()))
        .findFirst().map(NameValuePair::getValue)
        .orElse("");

return resultcode;