Skip to content

Instantly share code, notes, and snippets.

View gswallow's full-sized avatar

Greg Swallow gswallow

  • Indianapolis, IN, USA
View GitHub Profile
@gswallow
gswallow / security_group.tf
Created March 28, 2018 16:47
Active Directory security group
variable "tcp" { default = [42, 53, 88, 135, 137, 139, 389, 445, 636, 1512, 3268, 3269] }
variable "udp" { default = [42, 53, 88, 135, 137, 138, 389, 445, 1512] }
resource "aws_security_group" "active_directory" {
name = "active_directory"
description = "Allow AD Protocols"
vpc_id = "${module.aws_networks.vpc}"
tags {
Name = "active_directory_sg"
}
@gswallow
gswallow / adfs.sh
Last active March 9, 2018 17:24
Tooling around with Microsoft Azure
#!/bin/bash -e
# I wonder how much easier this is to do with Terraform :)
pw=$(openssl rand -base64 8)
ORG=${ORG:=dev}
AZ_LOCATION=${AZ_LOCATION:=eastus}
RESGROUP=${ORG}ADFSRG
# Resource Group must be created first.
az group create -l $AZ_LOCATION --name $RESGROUP
@gswallow
gswallow / lolmath
Last active February 22, 2018 18:19
LOL nested loops in HCL
irb(main):001:0> 3 - 0 % 3 - 1
=> 2
irb(main):002:0> 3 - 1 % 3 - 1
=> 1
irb(main):003:0> 3 - 2 % 3 - 1
=> 0
irb(main):004:0> 3 - 3 % 3 - 1
=> 2
irb(main):005:0> 3 - 4 % 3 - 1
=> 1
@gswallow
gswallow / gist:e07a08796094ac23cc888b39588b4587
Created December 13, 2017 22:18
quick & dirty nginx package
#!/bin/sh
yes | sudo pkg install gcc-6 autotools wget gmake pcre openssl
sudo portsnap fetch
sudo portsnap extract
cd /usr/ports/www/nginx
sudo OPTIONS_DEFAULT='DSO FILE_AIO HTTP HTTP_ADDITION HTTP_AUTH_REQ HTTP_CACHE HTTP_GZIP_STATIC HTTP_REALIP HTTP_REWRITE HTTP_SSL HTTP_STATUS THREADS HTTP_UPSTREAM_CHECK HTTP_UPSTREAM_FAIR HTTP_UPSTREAM_STICKY NAXSI' make config && sudo make && sudo make package
@gswallow
gswallow / base.tf
Created November 22, 2017 22:06
Terraform <3
provider "aws" {}
data "aws_region" "current" {
current = true
}
data "aws_availability_zones" "available" {}
@gswallow
gswallow / user-data.txt
Last active November 10, 2017 22:06
auto-scaling re-launcher
#!/bin/bash
set -o errexit -o errtrace -o pipefail
trap signal_and_exit ERR
function my_instance_id
{
curl -sL http://169.254.169.254/latest/meta-data/instance-id/
}
@gswallow
gswallow / rdp.sh
Last active March 16, 2022 23:12
Microsoft RDP client for mac pisses me off
#!/bin/bash -e
host=$1; shift
uri="rdp://full%20address=s:$host"
# Redirect
uri="${uri}&redirectdrives=i:1"
uri="${uri}&redirectclipboard=i:1"
@gswallow
gswallow / build.sh
Last active October 3, 2017 21:16
Build TokuMX 2.0.2 packages on Ubuntu Xenial
#!/bin/bash -e
# Install prerequisites
sudo apt-get -qq update && \
sudo apt-get -yqq install \
git-core \
cmake \
build-essential \
g++ \
zlib1g-dev \
kind: PersistentVolume
apiVerison: v1
metadata:
name: jenkins-pv-us-west-2a
labels:
jenkins: master
spec:
capacity:
storage: 80Gi
accessModes:
@gswallow
gswallow / pluginsandusers.groovy
Last active August 18, 2017 13:45
jenkins configmap stuff
println "Running plugin enumerator"
println ""
def plugins = jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
plugins.each {println "- ${it.getShortName()}:${it.getVersion()}"}
println ""
println "Total number of plugins: ${plugins.size()}"
println ""
println "Jenkins Users"