Skip to content

Instantly share code, notes, and snippets.

View kevingposture's full-sized avatar

kevingposture

View GitHub Profile
# Personal GitHub Account
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_github_personal
AddKeysToAgent yes
UseKeychain yes
# Work GitHub account (Posture)
Host github-posture
@kevingposture
kevingposture / getHost.sh
Last active May 8, 2025 22:45
Get hostname for a given domain
# get host of provided domain ie. - getHost [DOMAIN_NAME]
getHost() {
# clean out the http(s):// bit
local CLEAN_HOST=$(echo "$1" | sed -E 's~^https?://~~' | cut -d/ -f1)
# dig command to get the IP address, sometimes the output of this command includes the CNAME record so we'll use grep to filter and grab just the IP address
local IP_ADDRESS=$(dig +short "$CLEAN_HOST" A | grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$')
if [ -z "$IP_ADDRESS" ]; then
echo "No IP address found for $CLEAN_HOST"
return 1