Skip to content

Instantly share code, notes, and snippets.

View aeciopires's full-sized avatar

Aécio Pires aeciopires

View GitHub Profile
git remote add <other-fork-alias> <other-fork-URL>
git checkout <branch>
git fetch <other-fork-alias>
git cherry-pick <commit-hash>
git push <your-fork-alias>
git remote remove <other-fork-alias>
git remote -v
aeciopires / .bash_prompt
Last active February 10, 2024 11:25 — forked from jason-kane/.bash_prompt
Bash prompt with git branch and k8s context/namespace
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
aeciopires /
Last active January 21, 2022 10:41
Shell Script for update git repositories local
# Authors: Aecio Pires
# Date: 13 jan 2020
# Objective: Update git repositories local
#--------------------- REQUISITES --------------------#
# 1) Install packages: git
aeciopires / grafana-dashboard-exporter
Created November 20, 2018 21:40 — forked from crisidev/grafana-dashboard-exporter
Command to export all grafana 2 dashboard to JSON using curl
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json
aeciopires /
Created April 7, 2018 12:27 — forked from Faheetah/
Ansible bash module boilerplate
# Source arguments from Ansible
# These are passed into the module as $1 with a key=value format
# Sourcing this file sets the variables defined in the Ansible module
# Note that variables that are unused in the module are silently ignored
source $1
# Helper function to fail the module with the specified error
# This can accept $@ in printf for the full error
aeciopires / Dockerfile
Created April 7, 2018 12:27 — forked from Faheetah/Dockerfile
Docker patterns/anti-patterns
### Generic Dockerfile demonstrating good practices
### Imports
# Bad-ish, we do not need Ubuntu for this, nor do we want latest if we are using in a build system, predictable is better
FROM ubuntu:latest
# Better, using a small image since our app has no dependency on Ubuntu
FROM alpine:3.3
aeciopires / Jenkinsfile.groovy
Created April 7, 2018 12:26 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'No quotes in single backticks'
sh 'echo $BUILD_NUMBER'
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"'
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"'
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"'
echo 'Using three backslashes still results in preserving the single quotes'
aeciopires /
Created April 7, 2018 12:24 — forked from Faheetah/
Ansible RethinkDB dynamic inventory module
#!/usr/bin/env python
import json
import rethinkdb as r
from os import environ as env
HOST = env.get('RETHINK_HOST', '')
PORT = env.get('RETHINK_PORT', 28015)
DB = env.get('RETHINK_DB', 'inventory')
GROUP = env.get('RETHINK_GROUP', 'dev')