Skip to content

Instantly share code, notes, and snippets.

@cemk
Last active April 28, 2016 15:13
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 cemk/9e6cebe6b9fe47d6c1e9d76e358ab84f to your computer and use it in GitHub Desktop.
Save cemk/9e6cebe6b9fe47d6c1e9d76e358ab84f to your computer and use it in GitHub Desktop.
This bash script gets your devices local IPv4 and sets it to your zzzz.io domains. (My usecase: I carry around a Raspberry Pi for web development, and can set multiple domains in one line so I can continue testing no matter what network or device I'm on.)
#!/bin/bash
# Get your token from zzzz.io
ZZZZ_TOKEN="YOUR-TOKEN-HERE"
# Your domains as a list.
domains=("DOMAIN1" "DOMAIN2")
# Let the code do its thing.
LOCALIP="$(ifconfig wlan0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)"
echo "Local IP: $LOCALIP"
for DOMAIN in "${domains[@]}"
do
curl "https://zzzz.io/api/v1/update/$DOMAIN/?token=$ZZZZ_TOKEN&ip=$LOCALIP"
echo " $DOMAIN"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment