Skip to content

Instantly share code, notes, and snippets.

View PercussiveRepair's full-sized avatar

Jay Harrison PercussiveRepair

View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@PercussiveRepair
PercussiveRepair / instance_events_to_slack.py
Last active January 13, 2017 09:40
Send AWS instance retirement/maintenance events from multiple accounts/regions to Slack
#! /usr/bin/python
# gets instance events from mulitple accounts/regions and posts to slack
import boto3
from slackclient import SlackClient
from tabulate import tabulate
token = '<slack token>'
creds = open('<creds location>', 'r')
@PercussiveRepair
PercussiveRepair / gspread_example.py
Last active June 22, 2022 06:35
Python gspread example
#!/usr/bin/python
#csv upload to gsheet
import logging
import json
import gspread
import time
import re
from oauth2client.client import SignedJwtAssertionCredentials
@PercussiveRepair
PercussiveRepair / get_asgs.py
Created March 1, 2016 10:33
boto3 describe_auto_scaling_groups with full results
def get_asgs( key = None, secret = None ):
""" get autoscaling groups """
boto3.setup_default_session( region_name='eu-west-1', aws_access_key_id=key, aws_secret_access_key=secret )
client = boto3.client('autoscaling')
paginator = client.get_paginator('describe_auto_scaling_groups')
groups = paginator.paginate().build_full_result()
return groups['AutoScalingGroups']
@PercussiveRepair
PercussiveRepair / gist:bbe018d948d46bce236e
Created July 14, 2015 08:04
.ssh/config autocomplete
perl -ne 'print "$1 " if /^Host (.+)$/' ~/.ssh/config
# ssh autocomplete based on ~/.ssh/config
# I use this in my bashrc to expand hosts defined in ~/.ssh/config:
function _ssh_completion() {
perl -ne 'print "$1 " if /^Host (.+)$/' ~/.ssh/config
}
complete -W "$(_ssh_completion)" ssh
# Here's a great article on how to setup your own ~/.ssh/config:
# http://blogs.perl.org/users/smylers/2011/08/ssh-productivity-tips.html
@PercussiveRepair
PercussiveRepair / jkpl.css
Last active June 9, 2016 13:46 — forked from fbrnc/gist:66f9753144a5ea8db0c1
jenkins pipeline css
#build-pipeline-plugin-content {
background-color: none;
border-radius: 0;
}
#build-pipeline-plugin-content h1 {
display: none;
}
tbody.pipelineGroup {
#!/usr/bin/env python
'''
Send memory usage metrics to Amazon CloudWatch
This is intended to run on an Amazon EC2 instance and requires an IAM
role allowing to write CloudWatch metrics. Alternatively, you can create
a boto credentials file and rely on it instead.
Original idea based on https://github.com/colinbjohnson/aws-missing-tools
'''
#Encryption
openssl enc -in important_backups.tar.gz -aes-256-cbc -e > important_backups_encrypted.tar.gz
# Decryption
openssl enc -in important_backups_encrypted.tar.gz -aes-256-cbc -d > important_backups_decrypted.tar.gz