Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View felipe1982's full-sized avatar

Felipe Alvarez felipe1982

View GitHub Profile
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /home/felipe/.local/share/virtualenvs/moto-rPH6taE9/bin/python
cachedir: .pytest_cache
rootdir: /home/felipe/repos/moto, configfile: pytest.ini
plugins: forked-1.4.0, cov-3.0.0, xdist-2.5.0
collecting ... collected 58 items
tests/test_logs/logs_test.py::test_describe_metric_filters_happy_prefix PASSED
tests/test_logs/logs_test.py::test_describe_metric_filters_happy_log_group_name PASSED
tests/test_logs/logs_test.py::test_describe_metric_filters_happy_metric_name PASSED
---
#
# 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
tasks:
@felipe1982
felipe1982 / .gitconfig
Created August 1, 2018 11:13 — forked from rocketraman/.gitconfig
.gitconfig aliases useful for gitworkflows (article link TBD)
[alias]
# 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))' -
@felipe1982
felipe1982 / gist:e23f226b6d256cb760b05e8fcea9d071
Created July 13, 2018 01:00 — forked from cdown/gist:1163649
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
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
felipe1982 / s3_athena_restricted_lambda.py
Created June 14, 2018 03:20 — forked from colemanja91/s3_athena_restricted_lambda.py
Sample Athena S3 results tagging via AWS Lambda
"""
Lambda invocation to set security tags on Athena output; triggered by S3 Object
events
"""
import logging
import boto3
LOGGER = logging.getLogger()
@felipe1982
felipe1982 / s3_athena_restricted_policy.json
Created June 14, 2018 03:20 — forked from colemanja91/s3_athena_restricted_policy.json
Sample Athena Results S3 Policy for Restricted Data
{
"Version": "2012-10-17",
"Id": "Policy1523289797898",
"Statement": [
{
"Sid": "DenyRestrictedResultsAccess",
"Effect": "Deny",
"NotPrincipal": {
"AWS": [
"arn:aws:iam::{{ aws_account_id }}:user/{{ aws_user_name }}"
@felipe1982
felipe1982 / ansible-summary.md
Created October 17, 2017 03:57 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

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

Configuration file

intro_configuration.html

First one found from of

@felipe1982
felipe1982 / Ansible CloudFormation Macros.md
Created April 30, 2017 09:21 — forked from jheller/Ansible CloudFormation Macros.md
Using Ansible/Jinja macros to generate CloudFormation templates

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.
  1. Taking Gmail as an example, put the following into /etc/postfix/main.cf.

     relayhost = [smtp.gmail.com]: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