Skip to content

Instantly share code, notes, and snippets.

View cruftyoldsysadmin's full-sized avatar

Michael T Halligan cruftyoldsysadmin

View GitHub Profile
@cruftyoldsysadmin
cruftyoldsysadmin / resume.json
Last active March 20, 2023 11:24
resume.json
{
"basics": {
"name": "Michael T. Halligan",
"label": "Infrastructure as Code & DevOps Engineer",
"location": {
"city": "Istanbul",
"timezone": "UTC+3"
},
"email": "forrecruiteremail@gmail.com",
"profiles": [
@cruftyoldsysadmin
cruftyoldsysadmin / main.tf
Created September 20, 2022 07:25
main.tf
# CloudWatch Log Group metric filters for driftctl-slack.
module "filter" {
for_each = var.cloudwatch_log_filters
source = "terraform-aws-modules/cloudwatch/aws//modules/log-metric-filter"
version = "3.3.0"
log_group_name = local.aws_cloudwatch_log_group
metric_transformation_name = each.key
metric_transformation_namespace = "drifctl.scan"
metric_transformation_value = var.cloudwatch_log_filters[each.key].metric_value

Keybase proof

I hereby claim:

  • I am cruftyoldsysadmin on github.
  • I am cruftyold (https://keybase.io/cruftyold) on keybase.
  • I have a public key ASAw1b89MQEorjvS9Dn6j8x1md7c-u6nGuY923pZnNVYOwo

To claim this, I am signing this object:

// Initialize two arrays
ary1 = []
ary2 = []
// Iterate over each array
for ary in [ary1, ary2] {
// Set initial value of counter to 0 for an array index
count = 0
// Do this 1000 times
@cruftyoldsysadmin
cruftyoldsysadmin / logshell-route53-example.tf
Created September 3, 2019 17:15
Simple example of rich value types.
variable "route53_records_logshell" {
description = "logshell.io records"
type = map(object({
name = string
ttl = number
records = list(string)
type = string
}))
default = {
#!/usr/bin/env python2.7
"""
Usage: {prog} --user username \
--password password \ # Either password or Passfile is required
--passfile /etc/rabbitmq/secret \
--url http://localhost:15672/api/nodes/rabbitmq@dev-rmq-01 \
--metric partitions \
--metricname displayname.of.metric (optional)\
--debug (optional)
@cruftyoldsysadmin
cruftyoldsysadmin / pw_push.py
Created November 29, 2017 09:42
Python definition to wrap around https://pwpush.com/
#!/usr/bin/env python
# pw_push() Pushes password to pwpush.com
#
def pw_push(password):
pwp_token = requests.post('https://pwpush.com/p.json', data =
{
'password[payload]' : password,
'password[expire_after_day]' : 5,
'password[expire_after_views]' : 5,
@cruftyoldsysadmin
cruftyoldsysadmin / artifactory-user.py
Created November 14, 2017 15:20
First stab @ artifactory user management script.
#!/usr/local/bin/python2
import argparse
import json
import os
import pprint
import random
import re
import requests
import string
@cruftyoldsysadmin
cruftyoldsysadmin / README.txt
Last active March 1, 2017 13:24
Debbugging the nightmare that is Puppet ERB templates
If you have ever done *anything* with Puppet templates, you know how ugly it is to debug.
This Gist will help improve debugging and reduce guesswork. The main problem I always run into when debugging
ERB templates is grokking variable access.
I have included two code snippets:
- erb-dump.pp # Puppet manifest
- erb-dump.yaml.erb # ERB template to dump the entire namespace available to the template to /tmp/erb-dump.yaml
- erb-dump.rb # loads the yaml dump into a usable ruby hash
@cruftyoldsysadmin
cruftyoldsysadmin / stackdriver-maintenance.rb
Created March 1, 2017 12:23
Ruby script to query Stackdriver for all instances currently set to Maintenance mode.
#!/usr/bin/env ruby
#
require 'net/http'
require 'json'
apiKey ='APIKEYHERE'
params = { :apikey => apiKey }
instances = {}
counter = 0