Skip to content

Instantly share code, notes, and snippets.

View coryodaniel's full-sized avatar
☘️
O'Internets

Cory O'Daniel coryodaniel

☘️
O'Internets
View GitHub Profile
@coryodaniel
coryodaniel / GOMAXPROCS.downward_api.yaml
Last active January 5, 2024 15:47
Setting GOMAXPROCS to resource limits cpu using Kubernetes downward API
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mycontainer
image: myimage
resources:
limits:
@coryodaniel
coryodaniel / .pre-commit-hooks.yaml
Last active July 9, 2022 22:43 — forked from athiththan11/pre-commit
Git Pre Commit Hook for FIXME TODO
- id: deny-todos
name: Denies TODOs or FIXME
description: 'Denies TODOs or FIXME in commits'
entry: run.sh
language: script
@coryodaniel
coryodaniel / tf-aws-multiaz-vpc-w-az-cache.tf
Created November 16, 2021 22:14
Create multi-az VPC in AWS w/ Terraform and _not_ specifying individual zones
provider "aws" {
region = "us-west-2"
profile = "md-sandbox"
}
resource "aws_s3_bucket" "dont_create_me_in_same_script_obvi" {
bucket = "terraform-provisioning-cache"
acl = "private"
}
@coryodaniel
coryodaniel / kratos.ex
Created August 23, 2021 18:40
Kratos Sessions whoami client for elixir
defmodule Kratos do
defmodule Behaviour do
@moduledoc """
Defines function signature for secrets adapters
"""
@callback who_am_i(String.t()) :: {:ok, map()} | {:error, :unauthenticated}
end
@behaviour Kratos.Behaviour
@coryodaniel
coryodaniel / docker-compose.yaml
Created October 6, 2020 18:48
Multiple Docker Compose files sharing a network
---
version: "3"
networks:
local-dev:
driver: bridge
---
version: "3"
services:
shell:
image: busybox
@coryodaniel
coryodaniel / find-no-match.sh
Created August 28, 2020 17:45
Shell script to find "no match of right hand side" in elixir
#! /usr/bin/env bash
# This uses the silver searcher (ag)
TMP_FILE=$(mktemp)
# find :ok tuples w/ no error match
ag "^\s{0,}\{:ok.*\s=" --ignore 'test' -G '.ex$' . > ${TMP_FILE}
# find :ok left side matches w/ no error handling
ag "^\s{0,}:ok.*=" --ignore 'test' -G '.ex$' . >> ${TMP_FILE}
@coryodaniel
coryodaniel / slack-text-to-emoji.sh
Last active May 28, 2020 20:24
slack-text-to-emoji
# annoy emoji-name your message here
annoy() {
emoji=$1
msg="${@:2}"
figlet -f banner $msg | sed -e"s/#/:$emoji:/g" | sed -e's/ /:blank:/g' | pbcopy
}
@coryodaniel
coryodaniel / list.txt
Created May 13, 2020 22:04
GCP List of API Services
NAME TITLE
abusiveexperiencereport.googleapis.com Abusive Experience Report API
acceleratedmobilepageurl.googleapis.com Accelerated Mobile Pages (AMP) URL API
accessapproval.googleapis.com Access Approval API
accesscontextmanager.googleapis.com Access Context Manager API
actions.googleapis.com Actions API
adexchangebuyer-json.googleapis.com Ad Exchange Buyer API
adexchangebuyer.googleapis.com Ad Exchange Buyer API II
adexchangeseller.googleapis.com Ad Exchange Seller API
adexperiencereport.googleapis.com Ad Experience Report API
@coryodaniel
coryodaniel / terraform-state-demo.files
Last active May 7, 2020 23:25
terraform state move between multiple files demo
==> ./module <==
==> ./module/main.tf <==
variable "msg" {}
resource "null_resource" "goodbye" {
provisioner "local-exec" {
command = "echo ${var.msg}"
}
}
==> ./main.tf <==
@coryodaniel
coryodaniel / find_unused_routes.rb
Last active May 5, 2020 17:28
find unused rails routes
require "action_dispatch"
require "json"
# RIP your CPU if you have a lot of traffic. Check out the parallel gem w/ multiple processes to speed this up.
list_of_url_paths_visited = File.readlines("list_of_url_paths_visited.txt", chomp: true)
# YMMV
# the 2nd or 3rd column will be the path w/ awk
rake_routes_paths = `rake routes | awk '{if ($2 ~ /\\//) {print $2} else if ($3 ~ /\\//) {print $3}}'`.split("\n")