Skip to content

Instantly share code, notes, and snippets.

View diasjorge's full-sized avatar
🤖

Jorge Dias diasjorge

🤖
View GitHub Profile
{
"keepWaitingPipelines": false,
"lastModifiedBy": "jdias@example.com",
"limitConcurrent": true,
"parameterConfig": [],
"stages": [
{
"baseLabel": "release",
"baseOs": "bionic",
"cloudProvider": "gce",
@diasjorge
diasjorge / get-most-recent-ami-aws-cli.sh
Created June 19, 2019 14:51
Get most recent AWS AMI
aws ec2 --region us-east-1 describe-images --query 'reverse(sort_by(Images, &CreationDate))[0].ImageId' --output text
@diasjorge
diasjorge / find-message.sh
Created June 14, 2019 11:06
Find all branches first message
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 15:13
Tag elastic ips with their instance name using boto 3
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
#!/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)
#!/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')
#!/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
#! /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)
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:
;;; align-string.el --- align string components over several lines
;; Copyright (c) 2001 Markus Bjartveit Krüger
;; Author: Markus Bjartveit Krüger <markusk@pvv.org>
;; Created: 20-Sep-2001
;; Version: 0.1
;; Keywords: convenience
;; X-URL: http://www.pvv.org/~markusk/align-string.el