Skip to content

Instantly share code, notes, and snippets.

package spacelift
# Define the forbidden roles
forbidden_roles := {"editor", "owner"}
# Deny when creating or updating a google_project_iam_binding with forbidden roles
deny[sprintf("Resource '%s' has a forbidden role.", [resource.address])] {
# Select the resource from the input
resource := input.terraform.resource_changes[_]
# Check if the resource is a google_project_iam_binding and the action is either create or update
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"github.com/urfave/cli/v2"
"io"
"io/ioutil"
➜ dev cat piggybank.sh
#!/bin/bash
repos=$(curl -s -H "User-Agent: adamenger/bugcrowd" https://api.github.com/orgs/$1/repos | jq -r '.[].full_name')
for x in $repos;
do
trufflehog --regex -x exclude.txt git://github.com/$x
done;
#!/bin/bash
aws ec2 associate-address --instance-id $(curl http://169.254.169.254/latest/meta-data/instance-id) --allocation-id ${aws_eip_id} --allow-reassociation --region us-east-1
diff --git a/google/resource_google_project_services.go b/google/resource_google_project_services.go
index bc26d53..a39af2c 100644
--- a/google/resource_google_project_services.go
+++ b/google/resource_google_project_services.go
@@ -212,11 +212,11 @@ func enableServices(s []string, pid string, config *Config) error {
var sop *serviceusage.Operation
var err error
if len(s) > 1 {
- req := &serviceusage.BatchEnableServicesRequest{ServiceIds: s}
- sop, err = config.clientServiceUsage.Services.BatchEnable("projects/"+pid, req).Do()
#!/bin/bash
# date variables
year=$(date +"%Y")
month=$(date +"%m")
day=$(date +"%d")
for db in production staging
do
# give the archive a pretty name like name_datestamp
#!/bin/bash
# This script is used to deploy apps with a specially tweaked docker-compose.yml file
# and a Convox account.
# Exit immediately if a command exits with a non-zero status.
set -e
declare TAG='<TAG>'
declare DOCKER_COMPOSE=${DOCKER_COMPOSE:-docker-compose.yml}
@adamenger
adamenger / aws_ips.sh
Created November 2, 2016 19:40
find all ip blocks for a given region in aws
#!/bin/bash
function get_aws_ips() {
region=$1
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq ".prefixes[] | select(.region==\"$region\") | .ip_prefix" | tr -d '"'
}
if [ $# -eq 0 ]
then
echo "Usage: ./aws_ips.sh us-east-1"
exit 1
#!/usr/bin/env python
# Example ./subnet_finder.py https://whois.arin.net/rest/org/DROPB/nets
from BeautifulSoup import BeautifulSoup
import requests
import sys
# Spoof your agent here
user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"
# Set the user agent and accept headers, accept is required otherwise arin.net will return xml
/*
Staging VPC
This terraform plan describes the entire staging VPC. It is intended to be used to bring up and connect all of the staging infrastructure.
This plan does not include the actual staging environments, this is the infrastructure that lies beneath the environments.
*/
provider "aws" {
region = "us-east-1"
}