Skip to content

Instantly share code, notes, and snippets.

View parsley42's full-sized avatar

David Parsley parsley42

  • Welld Health
  • United States
View GitHub Profile
@parsley42
parsley42 / keybase.md
Created February 17, 2023 15:56
Proving who I am on Keybase

Keybase proof

I hereby claim:

  • I am parsley42 on github.
  • I am david_parsley (https://keybase.io/david_parsley) on keybase.
  • I have a public key ASBFnmyvX_KKzr7bvSbmC_bSi2Tp5KVIVHNfrLvClNnREwo

To claim this, I am signing this object:

@parsley42
parsley42 / chromebook.sh
Created January 9, 2023 22:27
Chromebook bootstrap
#!/bin/bash
if ! grep -q 'ssh-agent' $HOME/.bashrc
then
mkdir -p $HOME/.config/systemd/user
cat << "EOF" > $HOME/.config/systemd/user/ssh-agent.service
[Unit]
Description=SSH key agent
[Service]
@parsley42
parsley42 / aws-sso-session
Last active January 11, 2022 16:30
AWS SSO Session Script
#!/bin/bash -e
# aws-sso-session
# Sets up aws configuration from temporary credentials provided by SSO.
usage(){
cat >&2 <<EOF
Usage:
# These values should be pasted in from AWS SSO web app.
$ AWS_ACCESS_KEY_ID=<redacted>
@parsley42
parsley42 / aws-session
Created August 31, 2021 20:25
AWS Session Script
#!/bin/bash -e
# Usage: aws-session <token> (account)
# Sets up aws configuration for API access using temporary credentials
# See: https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/
# https://mharrison.org/post/aws_mfa/
usage(){
cat <<EOF
Usage: aws-session [-r <region>] ([-i] | <token> (account))
@parsley42
parsley42 / terraform_bash_completion.sh
Created August 12, 2021 15:42
Terraform Completion
# Bash Terraform completion
# Originally adapted from: https://gist.github.com/cornfeedhobo/8bc08747ec3add1fc5adb2edb7cd68d3
# Adapted from: https://gist.github.com/zish/85dccece461e050077997ff5d7d9c9d4 by Jeremy Melanson
#
#--- Get options listing from Terraform command.
_terraform_completion_get_opts () {
local CMD_EXEC="${1}"
local TF_OPT="${2}"
@parsley42
parsley42 / template.sh
Created May 18, 2021 14:11
Shell script template
#!/bin/bash -e
trap_handler()
{
ERRLINE="$1"
ERRVAL="$2"
echo "line ${ERRLINE} exit status: ${ERRVAL}"
# The script should usually exit on error
exit $ERRVAL
}
@parsley42
parsley42 / delete-ns.sh
Last active January 25, 2021 19:09
Delete kubernetes namespace stuck in Terminating; quick and dirty, YMMV
#!/bin/bash
if [ ! "$1" ]
then
echo "Missing namespace"
exit 1
fi
NAMESPACE=$1
@parsley42
parsley42 / bashrc
Created January 25, 2021 17:08
home bashrc
# User specific aliases and functions
source <(kubectl completion bash)
source <(helm completion bash)
source <(argocd completion bash)
complete -C '/usr/local/bin/aws_completer' aws
alias k=kubectl
complete -F __start_kubectl k
alias h=helm
complete -F __start_helm h
export PATH=$HOME/go/bin:/usr/local/go/bin:$PATH
@parsley42
parsley42 / README.md
Last active June 23, 2024 13:12
Chromebook ssh-agent setup

Setting up ssh-agent in Linux/Crostini on Chromebook

  • Create your user systemd directory:
$ mkdir -p .config/systemd/user
  • Edit the unit file .config/systemd/user/ssh-agent.service:
[Unit]
Description=SSH key agent
@parsley42
parsley42 / README.md
Last active November 10, 2018 23:04
Git Scripting Cheatsheet

Handy git commands for scripting

Get the commit hash

$ git rev-parse HEAD
# Short version
$ git rev-parse --short HEAD
# Previous commit
$ git rev-parse HEAD~1