Skip to content

Instantly share code, notes, and snippets.

View andrewalexander's full-sized avatar

Andrew Alexander andrewalexander

View GitHub Profile
@andrewalexander
andrewalexander / darcula.txt
Created November 15, 2018 17:14
Darcula Slack Theme
#2B2B2B,#323232,#CC7832,#FFFFFF,#323232,#8C8C8C,#629755,#AE8ABE
@andrewalexander
andrewalexander / bois.go
Last active October 24, 2018 18:22
mEmE fOrMaTtEr | a e s t h e t i c
package main
import (
"bytes"
"fmt"
"strings"
)
func main() {
guy := "this is why we can't have nice things"
@andrewalexander
andrewalexander / policy.yml
Created September 21, 2017 20:45
Custodian Security Group Issue
policies:
- name: ec2-invalid-sg-report
resource: ec2
description: |
Find all EC2 instances that are using soon-to-be-deprecated SGs
filters:
- type: value
key: tag:ApplicationGroup
value: ANDREWSTESTAPPLICATIONGROUP
// dependencies
var async = require('async');
var AWS = require('aws-sdk');
var gm = require('gm')
.subClass({ imageMagick: true }); // Enable ImageMagick integration.
var util = require('util');
// constants
var MAX_WIDTH = 100;
var MAX_HEIGHT = 100;
import os
import uuid
from c7n.policy import load
from c7n.resources import load_resources
from c7n.utils import Bag, yaml_load
def convert_sg_to_describe(event):
# convert CFT event to the format custodian expects (describe_security_groups)
# TODO: want some kind of schema validation for the event
@andrewalexander
andrewalexander / sg-egress.py
Created August 30, 2016 21:45
Shows the inconsistency between ingress and egress authorizations on security groups
import boto3
from botocore.exceptions import ClientError
client = boto3.client('ec2')
# Create VPC for testing
vpc_id = client.create_vpc(CidrBlock="10.42.0.0/16")['Vpc']['VpcId']
# Create SG
sg_id = client.create_security_group(
GroupName="egress-test",
VpcId=vpc_id,
@andrewalexander
andrewalexander / keybase.md
Created May 28, 2016 22:43
Used to verify my GitHub ownership with Keybase

Keybase proof

I hereby claim:

  • I am andrewalexander on github.
  • I am andrewalexander (https://keybase.io/andrewalexander) on keybase.
  • I have a public key ASArUoExqjMiH4iLnYFtEAr2ZvCMVtCnEvNcu4OvbvbrYAo

To claim this, I am signing this object:

@andrewalexander
andrewalexander / adblock.sh
Created April 29, 2016 23:05
Content Filtering on EdgeOS/VyOS
# Auto blocking ads, malware, etc on EdgeOS/VyOS
#
# Blatant rip-off/integration of https://gist.github.com/OnlyInAmerica/75e200886e02e7562fa1
# and http://www.bsdnow.tv/tutorials/dnsmasq
# any requests to blocked domains will instead route here
pixelserv_ip="10.0.0.1"
final_list='/etc/dnsmasq.d/dnsmasq.adlist.conf'
tmp_list="$final_list.tmp"