Skip to content

Instantly share code, notes, and snippets.

View rcbop's full-sized avatar

Rogerio Peixoto rcbop

  • Spain
View GitHub Profile
@rcbop
rcbop / instances-without-owner.sh
Created July 25, 2018 00:53
finds instances in ec2 without Owner label in all regions
#!/bin/bash
for region in $(aws ec2 describe-regions --output text | cut -f3); do
echo "REGIÃO -> $region"
aws ec2 describe-instances \
--query 'Reservations[].Instances[?!not_null(Tags[?Key == `Owner`].Value)].{PUBLICIP:PublicIpAddress,EC2ID:InstanceId,TYPE:InstanceType,STATE:State.Name,TAGS:Tags[*].{Key:Key,Value:Value}} | []' --region $region | jq '.'
done
@rcbop
rcbop / jenkinsfile
Created July 30, 2018 17:51
bind ssh private key and use it in a jenkinsfile example
node('node-label'){
stage('Deploy') {
withCredentials([[$class: 'SSHUserPrivateKeyBinding', credentialsId: "1dc9ca1e-a461-40c2-8478-969c66bea0b6", keyFileVariable: 'SSH_PRIVATE_KEY', passphraseVariable: '', usernameVariable: 'SSH_USERNAME']]){
sh "ssh-agent /bin/bash"
sh """
eval \$(ssh-agent) && ssh-add ${SSH_PRIVATE_KEY} && ssh-add -l &&
ENVIRONMENT=${env.ENVIRONMENT} \
PLAYBOOK=${env.PLAYBOOK} \
BASTION_USER=${env.BASTION_USER} \
@rcbop
rcbop / install-oracle-instant-client.sh
Created July 31, 2018 13:20
oracle instant client npm module dependencie
#!/usr/bin/env bash
#/
#/ :: ORACLE INSTANT CLIENT INSTALL SCRIPT ::
#/
#/ Automate install instructions for
#/
#/ https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#-6-node-oracledb-installation-on-macos-with-instant-client
#/
#/ WARNING:
#/ Download the sdk and basic instant client zip and place them in the same directory as this script
@rcbop
rcbop / create-users-report.sh
Created August 2, 2018 20:33
generate csv with IAM users, groups, access keys, login profile using aws cli and jq
#!/bin/bash
set -e
GRN="\033[0;32m"
NC="\033[0m"
generateUserEntry(){
# set -x
local username=$1
local groups=$2
local keys=$3
local web=$4
@rcbop
rcbop / git-remote-prune.sh
Created June 19, 2019 12:13
prune remotes
cd ${GITHUB_REPOS:?}
cd ~/kohls/github
for dir in $(find . -maxdepth 1 -type d | tail -n +2); do
cd $dir
git fetch --prune
git remote prune origin
cd ..
done
#!/bin/bash
DRY_RUN=${DRY_RUN:-"true"}
ECHO='echo '
OLDPWD=$(pwd)
cd ${GITHUB_DIR?:'yo man, provide a damn github root dir'}
for dir in $(find . -maxdepth 1 -type d | tail -n +2); do
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do
if [[ "$(git log $branch --since "2 months ago" | wc -l)" -eq 0 ]]; then
if [[ "$DRY_RUN" = "false" ]]; then
ECHO=""
@rcbop
rcbop / vault-tree-walk.sh
Created June 19, 2019 12:15
vault tree walk
#!/usr/bin/env bash
function walk() {
for secret in $(vault list $1 | tail -n +3)
do
if [[ ${secret} == *"/" ]] ; then
walk "${1}${secret}"
else
echo "${1}${secret}"
fi
#!/bin/sh
# Darkify Slack on Mac OS:
# curl https://gist.githubusercontent.com/ryanpcmcquen/8a7ddc72460eca0dc1f2dc389674dde1/raw/darkify_slack.sh | sh
SLACK_INTEROP_JS="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js"
# Thanks to: https://gist.github.com/DrewML/0acd2e389492e7d9d6be63386d75dd99#gistcomment-2358430
if [ -z "`grep tt__customCss ${SLACK_INTEROP_JS}`" ]; then
# Backup original CSS for reverts:
#!/usr/bin/env python3
"""Nexus Artifact Downloader
Search and download nexus artifacts.
Usage:
./artifact-downloader.py download [options]
./artifact-downloader.py search [options]
./artifact-downloader.py (-h | --help)
./artifact-downloader.py --version