Skip to content

Instantly share code, notes, and snippets.

View drewmace's full-sized avatar

Drew Mace drewmace

  • Fallston, Maryland, USA
View GitHub Profile
@drewmace
drewmace / ec2_sg_rules.py
Created September 30, 2021 12:14 — forked from amgill/ec2_sg_rules.py
Generate AWS Security Groups Rules Report of all the Security Groups, as Seen via AWS Web Console. Uses python 3 with boto3 to generate CSV.
#!/usr/local/bin/python3
######################################################################################################################
# Purpose: Generate rules report of all the security groups #
# Input Params: None [Make sure to set AWS CLI session by populating env. vars. with keys.] #
# Usage: ./ec2_sg_rules.py > account-date.csv [python ./ec2_sg_rules.py > gill-dev-sg-2018-04-11.csv] #
# Author: Abdul Gill #
# Doc. Ref: http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.describe_security_groups#
######################################################################################################################
from __future__ import print_function
@superseb
superseb / rancher2customnodecmd.sh
Last active June 4, 2024 20:16
Add custom node to Rancher 2.0 (from v2.0.0-alpha26 and up)
#!/bin/bash
docker run -d -p 80:80 -p 443:443 --name rancher-server rancher/rancher:latest
while ! curl -k https://localhost/ping; do sleep 3; done
# Login
LOGINRESPONSE=`curl -s 'https://127.0.0.1/v3-public/localProviders/local?action=login' -H 'content-type: application/json' --data-binary '{"username":"admin","password":"admin"}' --insecure`
LOGINTOKEN=`echo $LOGINRESPONSE | jq -r .token`
# Change password
@pierreozoux
pierreozoux / stale_security_groups.py
Last active September 30, 2021 01:31 — forked from astrikos/stale_security_groups.py
Script to detect stale AWS security groups
#!/usr/bin/env python3
import boto3
import argparse
class StaleSGDetector(object):
"""
Class to hold the logic for detecting AWS security groups that are stale.
"""
def __init__(self):
super(StaleSGDetector, self).__init__()
@negz
negz / kubedump.sh
Last active July 11, 2024 10:57
Dump Kubernetes cluster resources as YAML
#!/usr/bin/env bash
set -e
CONTEXT="$1"
if [[ -z ${CONTEXT} ]]; then
echo "Usage: $0 KUBE-CONTEXT"
exit 1
fi
@schickling
schickling / _README.md
Last active January 4, 2024 09:37
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@toddlers
toddlers / sec_groups_aws.py
Created October 20, 2015 18:58
Listing AWS Security groups with Python boto
#!/usr/bin/python
# Script will list all instances, all security groups and their rules for desired profile
# Before using script, you need to create "profile" file, which is ~/.aws/credentials where you put your AWS keys like this:
#
# [dev]
# aws_access_key_id = *****
# aws_secret_access_key = *****
#
# .. and then use it in this script
@pavgup
pavgup / osx-for-hackers.sh
Last active August 29, 2015 14:24 — forked from brandonb927/osx-for-hackers.sh
Healthy customization of sox-for-hackers.sh (yosemite style)
#!/bin/sh -x
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@pavgup
pavgup / osx_install.sh
Last active August 29, 2015 14:22 — forked from t-io/osx_install.sh
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@pavgup
pavgup / osx_install.sh
Last active August 29, 2015 14:22 — forked from t-io/osx_install.sh
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"