Skip to content

Instantly share code, notes, and snippets.

View JohnMcSpedon's full-sized avatar

John McSpedon JohnMcSpedon

  • Zoo Ventures LLC
  • Austin / Bay Area / Granada
View GitHub Profile
@JohnMcSpedon
JohnMcSpedon / new_gcp_project.sh
Created June 30, 2022 22:10
authorize a new google cloud project. save its default application credentials, so that it's easy to switch between projects
#@IgnoreInspection BashAddShebang
GCLOUD_DIR="$HOME/.config/gcloud"
: ${PROJECT_NAME?"Need to set PROJECT_NAME"}
if curl metadata.google.internal -i &> /dev/null; then
echo "Running on GCE instance. Skipping $PROJECT_NAME setup"
else
# https://stackoverflow.com/a/28938235/3893740
GREEN='\033[0;32m'
@JohnMcSpedon
JohnMcSpedon / gcp_utils.sh
Last active June 30, 2022 22:08
bash utils for easier use of GCP
alias glist="gcloud compute instances list | grep -v TERMINATED"
alias gssh="gcloud compute ssh --ssh-flag=\"-A\""
function gdel {
gcloud compute instances delete $@
}
GCLOUD_DIR="$HOME/.config/gcloud"
function switch_gcp_project {