Skip to content

Instantly share code, notes, and snippets.

View guilhermelinhares's full-sized avatar
🍷
building

Guilherme Linhares guilhermelinhares

🍷
building
View GitHub Profile
@guilhermelinhares
guilhermelinhares / InstallDocker.txt
Last active July 26, 2023 12:20
Install Docker + Docker Compose rootless | Ubuntu | With Fix EACCES var/run/docker.sock Vscode
apt-get update -y
#Init install docker
curl -fsSL https://get.docker.com | bash
newgrp docker
sudo usermod -aG docker $USER
sudo gpasswd -a $USER docker
#Optional -> In case you wanted root permission too
sudo usermod -aG docker root
#Init install and configure dockerd-rootless-setuptool.sh
@guilhermelinhares
guilhermelinhares / list_tags_groovy.txt
Last active November 17, 2022 14:43
List Tags Groovy Script - Git Jenkins Active Choices Parameter
git ls-remote -t -h
# -t = tag
# -h = header
def gettags = ("git ls-remote -t https://github.com/repo.git").execute()
return gettags.text.readLines().collect {
it.split()[1].replaceAll('refs/heads/', '').replaceAll('refs/tags/', '').replaceAll("\\^\\{\\}", '')
}
@guilhermelinhares
guilhermelinhares / regex_branch_master.txt
Last active November 17, 2022 14:43
Regex Branch Master - Jenkins Branch Filter
^(refs/heads/master.+|(?!refs/heads/master).*)$
@guilhermelinhares
guilhermelinhares / print_all_variabels_jenkins_pipeline.txt
Last active November 17, 2022 14:43
Print all variables jenkins pipeline
pipeline {
agent any
stages {
stage("Print Variables") {
steps {
sh "printenv | sort"
}
}
}
@guilhermelinhares
guilhermelinhares / fix_git_ssl.txt
Last active November 17, 2022 14:42
GIT_NO_SSL_VERIFY
#Fail Fix -> server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
#Method 1 -> Specific Repo
git -c http.sslVerify=false <command> <repo>.git
#Method 2 -> Global Config
git config --global http.sslVerify false
@guilhermelinhares
guilhermelinhares / jenkins_all_secrets_function.txt
Last active January 5, 2024 14:18
Get All Credentials in Jenkins Script
import com.cloudbees.plugins.credentials.Credentials
Set<Credentials> allCredentials = new HashSet<Credentials>();
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.Credentials.class
);
@guilhermelinhares
guilhermelinhares / servicenow_get_parameter.txt
Last active November 17, 2022 14:41
Get the value of the passed parameter - Servicenow
//Script Bussines Rules
var return_params = gs.action.getGlideURI().getMap().get('value_params');
@guilhermelinhares
guilhermelinhares / install_openconnect.txt
Last active November 17, 2022 14:41
Install openconnect by .tar.gz package
Ubuntu
#Install Prerequisites
apt-get update && \
apt-get install -y build-essential gettext autoconf automake \
libproxy-dev libxml2-dev libtool vpnc-scripts \
pkg-config iptables libgnutls28-dev libopenconnect-dev \
git sshpass procps \
libqt5widgets5 libqt5gui5 libqt5dbus5 libqt5network5 libqt5core5a
#Git Clone Latest
@guilhermelinhares
guilhermelinhares / crt_to_pem.txt
Last active November 17, 2022 14:41
Convert certificates .key .crt to .pem and full_chain
# Convert crt to pem
openssl x509 -in /<CERT_DIRECTORY>/NAME_CRT.crt -out NAME_CRT.pem -outform PEM
# Convert key to pem
openssl rsa -in /<CERT_DIRECTORY>/NAME_KEY.key -text > NAME_KEY.pem
# Convert to Full Path pem
cat NAME_KEY.pem NAME_CRT.pem > NAME-fullchain_full_chain.pem
@guilhermelinhares
guilhermelinhares / install_ansible.txt
Last active November 17, 2022 14:40
Install ansible
#Ubuntu
#Ref-> https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible