Skip to content

Instantly share code, notes, and snippets.

View undeadops's full-sized avatar

Mitch Anderson undeadops

View GitHub Profile
@undeadops
undeadops / index.ts
Last active July 29, 2022 22:19
pulumi - create inline iam policy
const kmsArns: pulumi.Output<string>[] = [];
config.get('kmsKeys').forEach((keyArgs: KmsKeyConfig) => {
const kms = new KmsKeys({
env: config.get('env'),
...keyArgs,
});
kmsArns.push(kms.arn);
});
const kmsInlinePolicy = pulumi.all(args.kmsKeys).apply((kmsKeys) => {
" Flash screen instead of beep sound
" set visualbell
" Change how vim represents characters on the screen
set encoding=utf-8
" Set the encoding of files written
set fileencoding=utf-8
" Color scheme
@undeadops
undeadops / traefik-alb.tf
Created April 15, 2020 23:55
Kubernetes ALB + Traefik Daemon Set Ingress Controller
// Traefik Ingress controller ALB
resource "aws_lb" "traefik" {
name = "traefik-alb"
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.traefik-ingress.id]
subnets = data.terraform_remote_state.vpc.outputs.vpc-public-subnets
enable_deletion_protection = true
enable_cross_zone_load_balancing = false
@undeadops
undeadops / watchdns-nginx.py
Created January 3, 2019 01:33
Watch upstream dns entries for changes, reload nginx based on changes
#!/usr/bin/env python
# Watch for DNS changes for heroku
import logging
from logging.handlers import SysLogHandler
import socket
import os
import yaml
import sys
import argparse
@undeadops
undeadops / prometheus-node-exporter.json
Created August 30, 2018 19:29
Prometheus Node Exporter
{
"annotations": {
"list": [
{
"$$hashKey": "object:84",
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
@undeadops
undeadops / main.go
Created May 13, 2018 00:55
FlippingFlipper
package main
import (
"fmt"
"strings"
)
func contains(slice []string, item string) bool {
set := make(map[string]struct{}, len(slice))
for _, s := range slice {
@undeadops
undeadops / main.go
Created February 6, 2018 21:45
aws-sdk-go-v2 - Route53 Create Invalid
package main
import (
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/awserr"
"github.com/aws/aws-sdk-go-v2/aws/external"
"github.com/aws/aws-sdk-go-v2/service/route53"
)
version: 2.0
jobs:
build:
working_directory: ~/knex
docker:
- image: hashicorp/terraform:0.10.0
steps:
- checkout
- run:
@undeadops
undeadops / main.go
Created June 13, 2017 05:51
Gin Main
package main
func main() {
log.Println("Starting app...")
app := gin.Default()
app.Use(DummyMiddleware)
app.Use(TokenAuthMiddleware())
v1 := app.Group("/v1")
{
v1.POST("/alerts", v1Alerts)
@undeadops
undeadops / handlers.go
Created June 13, 2017 05:32
gin MiddlewareTokenAuth
package main
// Custom Middleware for validating token
func TokenAuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
token := c.Request.Header.Get("X-Auth")
fmt.Println("X-Auth: ")
fmt.Println(token)
if token == "" {