Skip to content

Instantly share code, notes, and snippets.

Felipe Alvarez felipe1982

Block or report user

Report or block felipe1982

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View setup_git_credential_helper.yml
# Run this command on your local laptop to:
# 1. Create Remote "Origin" for codecommit repo
# 2. Configure Credential Helper for IAM authentication to repository.
- hosts: 'youi-ops-np'
connection: local
felipe1982 / .gitconfig
Created Aug 1, 2018 — forked from rocketraman/.gitconfig
.gitconfig aliases useful for gitworkflows (article link TBD)
View .gitconfig
# Basically `log --oneline --decorate --graph` with different colors and some additional info (author and date)
lg = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(auto)%d%C(reset)'
# lg (see above) with --first-parent
lgp = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(auto)%d%C(reset)' --first-parent
# List every branch, local and remote, in order of most recent to oldest commit, showing the branch's last commit and some last commit meta-data
br = for-each-ref --sort=-committerdate refs/heads/ refs/remotes/origin/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' -
View gist:e23f226b6d256cb760b05e8fcea9d071
urlencode() {
# urlencode <string>
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
felipe1982 /
Created Jun 14, 2018 — forked from colemanja91/
Sample Athena S3 results tagging via AWS Lambda
Lambda invocation to set security tags on Athena output; triggered by S3 Object
import logging
import boto3
LOGGER = logging.getLogger()
felipe1982 / s3_athena_restricted_policy.json
Created Jun 14, 2018 — forked from colemanja91/s3_athena_restricted_policy.json
Sample Athena Results S3 Policy for Restricted Data
View s3_athena_restricted_policy.json
"Version": "2012-10-17",
"Id": "Policy1523289797898",
"Statement": [
"Sid": "DenyRestrictedResultsAccess",
"Effect": "Deny",
"NotPrincipal": {
"AWS": [
"arn:aws:iam::{{ aws_account_id }}:user/{{ aws_user_name }}"
felipe1982 /
Created Oct 17, 2017 — forked from andreicristianpetcu/
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file


First one found from of

felipe1982 / Ansible CloudFormation
Created Apr 30, 2017 — forked from jheller/Ansible CloudFormation
Using Ansible/Jinja macros to generate CloudFormation templates
View Ansible CloudFormation

Generating CloudFormation Templates from YAML Dictionaries

The security group and Network ACLs parts of CloudFormation templates can be difficult to read. This template containing Jinja macros converts easier-to-read YAML dictionaries of security group and NACL rules into JSON.

Here ais a generic macro template and some example files showing how to use it.

  • cloudformation.macros.j2 - the macros
  • cf_vars.yml - YAML dictionaly of security groups and NACLs, including some complex rules for both
  • test.template.j2 - a simple CloudFormation template that uses the macro file
  • cf_test.yml - a simple Ansible playbook that generates CloudFormation JSON from thr previous file.
View Postfix: relay to authenticated
  1. Taking Gmail as an example, put the following into /etc/postfix/

     relayhost = []:587
     smtp_sasl_auth_enable = yes
     smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
     smtp_sasl_security_options = noanonymous
     smtp_sasl_mechanism_filter = plain
     smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
     smtp_use_tls = yes
     smtp_tls_security_level = encrypt
felipe1982 / Postfix: sender-dependent SASL
Created May 11, 2016 — forked from zmwangx/Postfix: sender-dependent SASL
Postfix: sender-dependent SASL authentication — relay to multiple SMTP hosts, or relay to the same host but authenticate as different users (e.g., two Gmail accounts)
View Postfix: sender-dependent SASL

This is a sequel to "Postfix: relay to authenticated SMTP".

I would like to send mail from two different Gmail accounts using Postfix. Here is the relevant section in the Postfix documentation: Configuring Sender-Dependent SASL authentication.

As a concrete example, here's how to set up two Gmail accounts (only relevant sections of the config files are listed below):

    # sender-dependent sasl authentication
    smtp_sender_dependent_authentication = yes
    sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
You can’t perform that action at this time.