Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rsmartins78's full-sized avatar

Rafael Martins rsmartins78

View GitHub Profile
@rsmartins78
rsmartins78 / aws-s3-cloudflare.json
Created October 5, 2022 21:39
Policy to allow a private bucket to be accessed only from Cloudflare proxy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<BUCKET_NAME_MUST_BE_EQUAL_TO_THE_FINAL_ADDRESS>/*",
"Condition": {
@rsmartins78
rsmartins78 / colorized_logs.sh
Created October 20, 2021 03:25
Colorized logs in shell script
#!/bin/bash
log () {
local red=$'\e[1;31m'
local yll=$'\e[1;33m'
local grn=$'\e[1;32m'
local blu=$'\e[1;34m'
# local mag=$'\e[1;35m'
# local cyn=$'\e[1;36m'
# local white=$'\e[1;37m'
@rsmartins78
rsmartins78 / startvm.sh
Last active June 15, 2018 17:57
Script to start a VirtualBox VM in CLI.
#!/bin/bash
#First Argument
START=$1
#Checking if exist argument.
if [ -z $START ]; then
echo "Please supply one argument with VM Name"
echo "Example: $0 docker"
exit 1
@rsmartins78
rsmartins78 / backup_gitlab.sh
Last active May 11, 2018 19:46
Script for Gitlab in Docker backup. It collects de Container ID, make an Docker exec, and move the file created in origin to destiny choosed.
#!/bin/bash
#############################################################################
## Nome: Gitlab-Backup ##
## Função: SCRIPT PARA AUTOMAÇÃO DE BACKUP DE ##
## UM GITLAB SERVER EXECUTADO EM DOCKER. ##
## PODE SER UTILIZADO PARA USO EM CRONTAB, POIS COLETA A ID CONTAINER. ##
## Linguagem: Shell Script ##
## ##
## OBRIGADO PELO APOIO ##
@rsmartins78
rsmartins78 / Vagrantfile
Created May 9, 2018 21:07
Vagrantfile example CentOS with provisioning script
Vagrant.configure("2") do |config|
config.vm.hostname = "docker"
config.vm.box = "centos/7"
config.vm.provision :shell, path: "install.sh"
config.vm.provider "virtualbox" do |virtualbox|
virtualbox.customize [ "modifyvm", :id, "--cpus", "1" ]
virtualbox.customize [ "modifyvm", :id, "--memory", "600" ]
end
end
@rsmartins78
rsmartins78 / install.sh
Last active May 9, 2018 21:08
Provisioner for Vagrantfile
#!/bin/bash
## Escolha abaixo o que será instalado !!
## 0 = Não, 1 = Sim
docker=1
ansible=1
## Caso haja proxy, favor definir abaixo
proxy=COLOCAR_IP_DO_PROXY
porta=COLOCAR_PORTA_DO_PROXY
@rsmartins78
rsmartins78 / rancher-get-info.sh
Created April 12, 2018 15:36 — forked from usmanismail/rancher-get-info.sh
A curl wrapper to get container info from the rancher API
#!/bin/sh
usage(){
echo "Usage: $0 ACCESS_KEY ACCESS_SECRET CONATAINER_ID"
exit 1
}
# call usage() function if filename not supplied
[[ $# -ne 3 ]] && usage