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 / routing.md
Last active February 11, 2024 02:03
Routing table
1	   0.0.0.0	        0.0.0.0	         x.x.x.x        	WAN	          0
    
2	   X.X.X.X	        255.255.255.0	   0.0.0.0	        WAN 	        0

3    10.10.1.0	      255.255.255.0	   0.0.0.0	        office_srv2	0 

4	   192.168.1.0	    255.255.255.0	   0.0.0.0	        office_wrk2	0

x.x.x.x = public ip of office 1 router with ipsec endpoint

@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
@drewmace
drewmace / security-group-cleanup.py
Created September 30, 2021 01:37 — forked from ymcdull/security-group-cleanup.py
A simple python file to clean up all unused AWS security groups with boto3
#!/usr/bin/env python
import boto3
### ###
# Need aws credentails already been configured #
### ###
### Code based on https://gist.github.com/miketheman/2630437
client = boto3.client('ec2')
@drewmace
drewmace / stale_security_groups.py
Created September 30, 2021 01:31 — forked from pierreozoux/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__()
@drewmace
drewmace / EC2-Stopped-Tagged-Lambda.py
Created August 27, 2021 01:41 — forked from mlapida/EC2-Stopped-Tagged-Lambda.py
Using a lambda function, stop all instances that are tagged appropriately.
import boto3
import logging
#setup simple logging for INFO
logger = logging.getLogger()
logger.setLevel(logging.INFO)
#define the connection
ec2 = boto3.resource('ec2')
@drewmace
drewmace / git.migrate
Last active October 3, 2018 12:18 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 0. List Remotes
git remote -v
@drewmace
drewmace / AprConfiguration.java
Created March 2, 2017 13:50 — forked from andreldm/AprConfiguration.java
APR on Spring Boot
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.core.AprLifecycleListener;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* NOTE: You also need to install APR on your system, on Arch Linux the package is called `tomcat-native`.
@drewmace
drewmace / DockerCommands.md
Last active January 5, 2017 12:11
Docker common commands

Docker Commands

List images:

docker images

List running docker processes:

docker ps
How to update sdkman from gvm
http://mike-neck.hatenadiary.com/entry/2015/09/17/234228