Skip to content

Instantly share code, notes, and snippets.

Jorge Dias diasjorge

Block or report user

Report or block diasjorge

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 wait_for_instance_profile.py
#!/usr/bin/python
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
View redblack.json
{
"keepWaitingPipelines": false,
"lastModifiedBy": "jdias@example.com",
"limitConcurrent": true,
"parameterConfig": [],
"stages": [
{
"baseLabel": "release",
"baseOs": "bionic",
"cloudProvider": "gce",
View get-most-recent-ami-aws-cli.sh
aws ec2 --region us-east-1 describe-images --query 'reverse(sort_by(Images, &CreationDate))[0].ImageId' --output text
@diasjorge
diasjorge / find-message.sh
Created Jun 14, 2019
Find all branches first message
View find-message.sh
while read line; do
branch=$(echo $line | awk '{print $1}')
message=$(echo $line| sed 's/origin[^ ]* //')
commits=$(git log origin/master --format=oneline --grep "$message")
if [ -n "$commits" ]; then
echo "$branch - $message"
echo "-"
echo "$commits"
echo ""
fi
@diasjorge
diasjorge / tag-eip-instance-name.py
Last active May 30, 2019
Tag elastic ips with their instance name using boto 3
View tag-eip-instance-name.py
import boto3
ec2 = boto3.client('ec2', region_name='us-east-2')
addresses = ec2.describe_addresses()['Addresses']
for address in addresses:
if 'InstanceId' not in address:
continue
View cleanup.py
#!/usr/bin/env python
from google.cloud import monitoring_v3
# # Using a service account with credentials in a json file:
# JSON_CREDS = 'monitoring.json'
# from oauth2client.service_account import ServiceAccountCredentials
# scopes = ["https://www.googleapis.com/auth/monitoring",]
# credentials = ServiceAccountCredentials.from_json_keyfile_name(
# JSON_CREDS, scopes)
View toggleSubjectAlerts.py
#!/usr/bin/env python
#
# Script for disabling all alerts on a device
# chmod to make executable, then ./toggleSubjectAlerts.py -s [SubjectID] -t [SubjectType] -a [APIToken] -e [True/False] -g [groupName]
import requests
import json
import argparse
parser = argparse.ArgumentParser(description='This is a script for enabling / disabling all alerts on a device')
View gist:4385f6ce90f45920e43b605dbdf9b691
#!/usr/bin/env bash
NAMESPACE=${1}
POD=${2}
COMMAND=${3:-sh}
USER=${4:-root}
KUBECTL=kubectl
NEW_POD_NAME=exec-user-${POD}
NEW_POD_NAME=${NEW_POD_NAME:0:63} # max len allowed
View aws-autoscaling-cronjob.sh
#! /bin/bash
instance_id=$(ec2metadata --instance-id)
availability_zone=$(ec2metadata --availability-zone)
region=${availability_zone::-1}
asg_name=$(aws --region $region --output text autoscaling describe-auto-scaling-instances --instance-ids $instance_id --query 'AutoScalingInstances[0].AutoScalingGroupName')
first_instance_id=$(aws --region $region --output text autoscaling describe-auto-scaling-groups --auto-scaling-group-names $asg_name --query "AutoScalingGroups[].Instances[?HealthStatus == 'Healthy'].InstanceId" | sort | head)
View spinnaker-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: spinnaker-ingress
namespace: spinnaker
annotations:
ingress.gcp.kubernetes.io/pre-shared-cert: "GOOGLE_MANAGED_CERT"
kubernetes.io/ingress.global-static-ip-name: "spinnaker"
kubernetes.io/ingress.allow-http: "false"
spec:
You can’t perform that action at this time.