Skip to content

Instantly share code, notes, and snippets.

@ericboehs
Last active February 1, 2024 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericboehs/1569377fb54a4d31cb7aed70be31cc02 to your computer and use it in GitHub Desktop.
Save ericboehs/1569377fb54a4d31cb7aed70be31cc02 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
# <bitbar.title>VA SOCKS</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Eric Boehs</bitbar.author>
# <bitbar.author.github>ericboehs</bitbar.author.github>
# <bitbar.desc>Connects to VA SOCKS and provides useful links</bitbar.desc>
# <swiftbar.hideAbout>true</swiftbar.hideAbout>
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
# <swiftbar.hideLastUpdated>true</swiftbar.hideLastUpdated>
# <swiftbar.hideDisablePlugin>true</swiftbar.hideDisablePlugin>
# <swiftbar.hideSwiftBar>true</swiftbar.hideSwiftBar>
PID_LISTENING=$(lsof -Pi :2001 -sTCP:LISTEN -t)
PROCESS_LISTENING=$(ps -p $PID_LISTENING -o comm=)
SOCKS_CONNECTED=$(ps $PID_LISTENING | grep -q ssh && echo true || echo false)
if $SOCKS_CONNECTED; then
echo ":lock.icloud: | size=16 shortcut=OPT+S"
else
echo ":icloud.slash: | size=16 shortcut=OPT+S"
fi
echo "---"
echo "VA SOCKS"
echo "---"
if $SOCKS_CONNECTED; then
echo "Reconnect | bash='/Users/ericboehs/.asdf/shims/vtk' param1='socks' param2='on' terminal=false"
echo "Disconnect | bash='/Users/ericboehs/.asdf/shims/vtk' param1='socks' param2='off' terminal=false"
echo "Kill $PROCESS_LISTENING | bash='kill' param1=\"$PID_LISTENING\" terminal=false alternate=true"
else
echo "Connect | bash='/Users/ericboehs/.asdf/shims/vtk' param1='socks' param2='on' terminal=false"
if [ -n "$PROCESS_LISTENING" ]; then
echo "Kill $PROCESS_LISTENING | bash='kill' param1=\"$PID_LISTENING\" terminal=false"
fi
fi
echo "---"
echo "ArgoCD | href='https://argocd.vfs.va.gov'"
echo "-- vets-api-dev | href='https://argocd.vfs.va.gov/applications/vets-api-dev'"
echo "-- vets-api-staging | href='https://argocd.vfs.va.gov/applications/vets-api-staging'"
echo "-- vets-api-sandbox | href='https://argocd.vfs.va.gov/applications/vets-api-sandbox'"
echo "-- vets-api-prod | href='https://argocd.vfs.va.gov/applications/vets-api-prod'"
echo "Jenkins | href='http://jenkins.vfs.va.gov'"
echo "Sentry | href='http://sentry.vfs.va.gov'"
echo "Grafana/Loki | href='http://grafana.vfs.va.gov'"
echo "Prometheus | href='http://prometheus-prod.vfs.va.gov:9090'"
echo "---"
echo "AWS Console | href='http://dsvagovcloud.signin.amazonaws-us-gov.com/console'"
echo "Datadog | href='http://vagov.ddog-gov.com'"
@ericboehs
Copy link
Author

Screenshot.2024-01-05.at.10.20.01.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment