Skip to content

Instantly share code, notes, and snippets.

View HelioCampos's full-sized avatar

Helio Campos Mello de Andrade HelioCampos

View GitHub Profile
@HelioCampos
HelioCampos / 0main.md
Created January 16, 2018 18:27 — forked from pandeiro/0main.md
Git Best Practices

Git Best Practices

This is a fairly common question, and there isn't a One True Answer, but still, this represents a consensus from #git

Read about git

Knowing where to look is half the battle. I strongly urge everyone to read (and support) the Pro Git book. The other resources are highly

@HelioCampos
HelioCampos / aws-cli-examples.sh
Last active October 15, 2018 16:09 — forked from namuan/aws-cli-examples.sh
[AWS CLI examples] #aws #cli #filter #query
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[*]'
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[*].Tags[?Key==`Name`]'
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?Tags[?starts_with(Value, `registration`)]]'
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?Tags[?starts_with(Value, `email`)]]'
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[] | [?contains(Tags[?Key==`Name`].Value, `email-01`)]' --output table
@HelioCampos
HelioCampos / example.ps1
Created December 20, 2018 00:44 — forked from magnetikonline/example.ps1
PowerShell example for an AWS Route53 record upsert.
Set-StrictMode -Version Latest
$HOSTED_ZONE_ID = "ABCDEFGHIJKLM"
$changeRequest01 = New-Object -TypeName Amazon.Route53.Model.Change
$changeRequest01.Action = "UPSERT"
$changeRequest01.ResourceRecordSet = New-Object -TypeName Amazon.Route53.Model.ResourceRecordSet
$changeRequest01.ResourceRecordSet.Name = "record01.domain.com"
@HelioCampos
HelioCampos / Manage-R53RecordSet.ps1
Created December 20, 2018 00:44 — forked from lorengordon/Manage-R53RecordSet.ps1
PowerShell Script to Create/Delete/Update AWS Route53 Record Set
[CmdLetBinding()]
Param(
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)]
[String] $HostedZoneId,
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)]
[ValidateSet("CNAME","A","AAAA","MX","TXT","PTR","SRV","SPF","NS","SOA")]
[String] $Type,
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)]
@HelioCampos
HelioCampos / chefquery.ps1
Created February 9, 2019 08:31 — forked from devblackops/chefquery.ps1
PowerShell script to query Chef nodes via REST API. Assumes you have the BouncyCastle.Crypto.dll in the same folder as the script.
function Get-Base64 {
param (
$data
)
# if the $data is a string then ensure it is a byte array
if ($data.GetType().Name -eq "String") {
$data = [System.Text.Encoding]::UTF8.GetBytes($data)
}
@HelioCampos
HelioCampos / rabbitmq2cloudwatch
Created April 26, 2019 08:21 — forked from justcompile/rabbitmq2cloudwatch
Bash script sending RabbitMQ metrics to AWS CloudWatch
#! /bin/bash
# This script reads rabbitmq statistics and report them as CloudWatch metrics.
# Author: Richard Hayes - Forked from Mirek Svoboda
# Version: 0.5
# TABSTOP=4
#
# Changelog:
# 0.5
# -- Added TotalMessages & TotalConsumers metrics
# 0.4
@HelioCampos
HelioCampos / README.md
Created September 16, 2019 10:41 — forked from avoidik/README.md
AWS query examples

Top 10 Examples of AWS CLI Query

List Volumes showing attachment using Dictionary Notation

$ aws ec2 describe-volumes \
  --query 'Volumes[*].{ID:VolumeId,InstanceId:Attachments[0].InstanceId,AZ:AvailabilityZone,Size:Size}'
[
    {
        "InstanceId": "i-a071c394",
@HelioCampos
HelioCampos / README.md
Created September 16, 2019 10:41 — forked from avoidik/README.md
AWS query examples

Top 10 Examples of AWS CLI Query

List Volumes showing attachment using Dictionary Notation

$ aws ec2 describe-volumes \
  --query 'Volumes[*].{ID:VolumeId,InstanceId:Attachments[0].InstanceId,AZ:AvailabilityZone,Size:Size}'
[
    {
        "InstanceId": "i-a071c394",
if [ -n "$SSH_AUTH_SOCK" ] && netstat -nlpx 2> /dev/null | awk '{print $NF}' | grep -qF "$SSH_AUTH_SOCK"; then
echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > /tmp/ssh-agent$UID
if [ -n "$SSH_AGENT_PID" ]; then
echo "export SSH_AGENT_PID=$SSH_AGENT_PID" >> /tmp/ssh-agent$UID
elif [ -n "$GNOME_KEYRING_PID" ]; then
echo "export GNOME_KEYRING_SOCKET=$GNOME_KEYRING_SOCKET" >> /tmp/ssh-agent$UID
echo "export GNOME_KEYRING_PID=$GNOME_KEYRING_PID" >> /tmp/ssh-agent$UID
fi
else
SSH_AUTH_SOCK=