Skip to content

Instantly share code, notes, and snippets.

View gustavomcarmo's full-sized avatar

Gustavo Muniz do Carmo gustavomcarmo

View GitHub Profile
@gustavomcarmo
gustavomcarmo / configPhpMaxSize.sh
Created July 18, 2018 09:19
Shell script to define the post_max_size and the upload_max_filesize values in the php.ini file.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "One parameter expected:"
echo "- the new size limit (in Mb)"
exit 1
fi
SIZE_IN_MB=$1
if [[ ! $SIZE_IN_MB =~ ^[0-9]+$ || $SIZE_IN_MB -eq 0 ]]; then
@gustavomcarmo
gustavomcarmo / playbook-docker-compose-moodle.yml
Created July 6, 2018 14:01
Just an example of Ansible playbook that runs docker-compose and then waits the MySQL container until it becomes ready. Tested on Ubuntu 18.04 LTS (Bionic Beaver).
---
- hosts: moodle
gather_facts: no
become: yes
tasks:
- name: Install required packages
apt:
name: "{{item}}"
update_cache: yes
language: java
sudo: required
install: true
services:
- docker
addons:
sonarcloud:
organization: "gustavomcarmo-github"
@gustavomcarmo
gustavomcarmo / SeleniumUtils.java
Created July 3, 2018 08:59
Simple Selenium utilitary Java class with a method for waiting a DOM element to be interactable and a method to click an element through Javascript.
package br.com.esign.selenium.utils;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
/**
* Selenium utilitary class
@gustavomcarmo
gustavomcarmo / playbook-nexus-maven-settings.yml
Created June 29, 2018 07:59
Ansible playbook to setup a Maven environment for a user in a remote host. The user then will use a instance of Nexus for downloading Java artifacts.
---
- hosts: nexus-client-hosts
gather_facts: no
vars_prompt:
- name: "maven_master_password"
prompt: "Maven master password"
private: yes
- name: "nexus_username"
prompt: "Nexus username"
@gustavomcarmo
gustavomcarmo / bamboo-tag-setting.sh
Created June 27, 2018 13:48
Script to set the TAG value for posterior using in Bamboo job. Assumes the TAG is not latest if follows the semantic versioning, starting with v.
#!/bin/bash
rx='^v([0-9]+\.){0,2}(\*|[0-9]+)$'
if [[ ${bamboo.planRepository.1.revision} =~ $rx ]]; then
TAG=${bamboo.planRepository.1.revision}
else
TAG=latest
fi
echo TAG=$TAG > properties.txt
cat properties.txt