Skip to content

Instantly share code, notes, and snippets.

View jonathanhle's full-sized avatar

Jonathan Le jonathanhle

View GitHub Profile
@ryan0x44
ryan0x44 / Terraform-Blue-Green-AWS.md
Created November 19, 2015 21:57
Blue-Green AWS Auto Scaling Deployments with Terraform

A quick note on how I'm currently handling Blue/Green or A/B deployments with Terraform and AWS EC2 Auto Scaling.

In my particular use case, I want to be able to inspect an AMI deployment manually before disabling the previous deployment.

Hopefully someone finds this useful, and if you have and feedback please leave a comment or email me.

Overview

I build my AMI's using Packer and Ansible.

@alertedsnake
alertedsnake / stupidboto3.py
Last active September 2, 2019 17:31
Get a list of instances in an AWS autoscaling group, with boto3. I set MaxRecords=2 to experiment with the pagination, it does seem to return the whole list when not set, but.....
import boto3
def as_get_instances(client, asgroup, NextToken = None):
# this is downright ridiculous because boto3 sucks
irsp = None
if NextToken:
irsp = client.describe_auto_scaling_instances(MaxRecords=2, NextToken=NextToken)
else:
@maxim
maxim / gh-dl-release
Last active May 13, 2025 00:14
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@danielalvarenga
danielalvarenga / terminal-colors-branch.sh
Last active June 30, 2025 07:30
Show branch in terminal Ubuntu
# Add in ~/.bashrc or ~/.bash_profile
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[01;31m\]"
YELLOW="\[\033[01;33m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
NO_COLOR="\[\033[00m\]"
@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active July 4, 2025 12:53
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
@tuxfight3r
tuxfight3r / jenkins-decrypt.groovy
Created September 23, 2015 11:36
Decrypting Jenkins Password
#To Decrypt Jenkins Password from credentials.xml
#<username>jenkins</username>
#<passphrase>your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J</passphrase>
#go to the jenkins url
http://jenkins-host/script
#In the console paste the script
hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J'
@mdang
mdang / SDLC.md
Last active January 10, 2025 10:52
Lesson: SDLC

The Software Development Life Cycle

Learning Objectives

Conceptual

  • Explain what SDLC is and why we use it
  • Provide a general overview of what "Agile" means and compare it to Waterfall
  • Explain what SCRUM is, and how it relates to agile.
  • Describe the process of requirements gathering.
  • Explain what a user story is, and what specific points it should include.
@halberom
halberom / opt1_template.j2
Last active January 17, 2025 12:34
ansible - example of template if else
{# style 1 - long form #}
{% if filepath == '/var/opt/tomcat_1' %}
{% set tomcat_value = tomcat_1_value %}
{% else %}
{% set tomcat_value = tomcat_2_value %}
{% endif %}
{# style 2 - short form #}
{% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %}
@mbbx6spp
mbbx6spp / ALTERNATIVES.adoc
Last active January 7, 2025 16:25
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
@mahnve
mahnve / gist:a173857078ecf5849dce
Last active August 30, 2022 21:47
get list of AWS us east ip ranges
curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes' | jq 'map(select(.region=="us-east-1"))' | jq 'map(.ip_prefix)'