Skip to content

Instantly share code, notes, and snippets.

View dalmosantos's full-sized avatar

Dalmo Santos dalmosantos

View GitHub Profile
@dalmosantos
dalmosantos / port-check.sh
Created January 31, 2018 21:24 — forked from stojg/port-check.sh
port-check.sh - small script to check if TCP ports are opened through firewalls etc.
#!/bin/bash
function checkport {
if nc -zv -w30 $1 $2 <<< '' &> /dev/null
then
echo "[+] Port $1/$2 is open"
else
echo "[-] Port $1/$2 is closed"
fi
}
pipeline {
// run on jenkins nodes tha has java 8 label
agent { label 'java8' }
// global env variables
environment {
EMAIL_RECIPIENTS = 'mahmoud.romeh@test.com'
}
stages {
stage('Build with unit testing') {
@dalmosantos
dalmosantos / clean_docker_nexus.sh
Created April 16, 2018 18:12 — forked from matzegebbe/clean_docker_nexus.sh
Nexus Repository Manager keep the last X docker images delete all other
#!/bin/bash
REPO_URL="https://repository.xxx.net/repository/"
USER="admin"
PASSWORD="datpassword"
BUCKET="portal-docker"
KEEP_IMAGES=10
IMAGES=$(curl --silent -X GET -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -u ${USER}:${PASSWORD} "${REPO_URL}${BUCKET}/v2/_catalog" | jq .repositories | jq -r '.[]' )
@dalmosantos
dalmosantos / elk.sh
Last active July 1, 2019 12:17 — forked from kydouglas/elk.sh
Bash Script to Install Elastic Search, Logstash and Kibana
#!/bin/bash
#title :createenvironment-elk.sh
#description :shell script to create environments (elasticsearch,logstash and kibana)
#date :2018-04-19
#usage :sudo ./elk.sh
#used version :6.2.4
#tested-version :1.2.0
#tested-distros :CentOS 7.4
# Checking whether user has enough permission to run this script
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "puppet" do |puppet|
puppet.vm.box = "centos/7"
puppet.vm.network "private_network", ip: "192.168.33.100"
puppet.vm.hostname = "puppet"
puppet.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "4096"]
@dalmosantos
dalmosantos / Jenkinsfile
Created July 19, 2018 14:47 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
/*
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>
@dalmosantos
dalmosantos / Jenkinsfile
Created July 19, 2018 14:47 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
/*
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>
@dalmosantos
dalmosantos / deploy
Created October 1, 2018 22:06 — forked from byjamaljama/deploy
My semi-automatic deployment script
#!/usr/bin/env bash
# Repository
REPOSITORY="username/project.git"
# GIT CLONE DIRECTORY
DIRECTORY="myproject"
# Path to project parent dir
PROJECT_PATH="path/to/project"
@dalmosantos
dalmosantos / Jenkinsfile
Created October 10, 2018 23:04 — forked from jrichardsz/Jenkinsfile
Jenkins Declarative Pipeline Example
def getProjectName() {
return 'JenkinsPipeline'
}
def getJDKVersion() {
return 'jdk1.8.0_101'
}
def getMavenConfig() {
return 'maven-config'
@dalmosantos
dalmosantos / jslint_with_juicer.py
Created October 19, 2018 18:28 — forked from olleolleolle/jslint_with_juicer.py
jslint.py: Here is my take on bash scripting: using Python's subprocess module.
#!/usr/bin/env python
import subprocess
import fnmatch
import os
import os.path
from string import Template
from optparse import OptionParser
import webbrowser
import string
import datetime