Skip to content

Instantly share code, notes, and snippets.

View omkensey's full-sized avatar

Joe Thompson omkensey

View GitHub Profile
#!/bin/bash
PROVIDERS_DEFAULT="aws,awscc,google,azurerm,azuread"
PROVIDERS=""
SEARCH_LOC_DEFAULT=$HOME
SEARCH_LOC=""
TF_BIN=""
STATE_FILE_NAME="terraform.tfstate"
search_states() {
@omkensey
omkensey / cloudinit-template-example.tf
Created September 29, 2022 23:39
An elaborate example of using locals with template_cloudinit_config.
locals {
hashicorp_apt_gpg_key = file("${path.module}/config_files/hashicorp_apt_gpg_key.pub")
cloudinit_config_server = {
write_files = [
{
content = local.hashicorp_apt_gpg_key
owner = "root:root"
path = "/root/hashicorp-deb-key.pub"
permissions = "0644"
},
@omkensey
omkensey / mute.py
Created March 15, 2022 03:07
Luxafor interface script just for playing with color/brightness effects
# Based on https://github.com/jamesmdavies88/LuxaforMute/blob/main/mute.py
# Make sure to do the udev configuration there first
# This script also catches a SIGINT and turns off the LEDs, then exits cleanly
from array import array
import usb.core
import usb.util
import os
import signal
import sys
@omkensey
omkensey / mute.py
Created March 15, 2022 03:03
LuxaforMute script with amixer used to mute/unmute
# Based on https://github.com/jamesmdavies88/LuxaforMute/blob/main/mute.py
# Make sure to do the udev configuration there first
from array import array
import usb.core
import usb.util
import os
def main():
#!/bin/bash
# Dependencies: AWS CLI, GNU sort, bc
# Tested on Fedora 35.
# Requires valid AWS creds be available to the AWS CLI.
# Example usage:
# find-free-vpcs.sh
@omkensey
omkensey / .bash_profile.snip
Created April 12, 2018 21:47
Snippet to add k8s and git context to bash prompt when relevant
OLDPROMPT="$PS1"
prompt_set() {
if [ "$KUBECONFIG" != "" ]; then
PROMPT_KUBECONTEXT="k8s:$(kubectl config get-contexts --no-headers $(kubectl config current-context 2>/dev/null) 2>/dev/null | awk '{print substr($2,1,13)"..."substr($2,length($2)-19)}')\n"
fi
GIT_BRANCH=$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/{\1}/')
PROMPT_BRANCH=$(echo "$OLDPROMPT" | sed -e 's/\\u/\\u'${GIT_BRANCH}'/')
PS1="$PROMPT_KUBECONTEXT""$PROMPT_BRANCH"
}
if [ -f ~/.ssh-agent ] && [ /dev/console -nt ~/.ssh-agent ]; then
rm -f ~/.ssh-agent
echo "Deleted old agent environment file."
fi
if [ ! -f ~/.ssh-agent ]; then
echo "Starting agent."
ssh-agent > ~/.ssh-agent
fi