Scan the network for a device based on its mac address, find it, get its IP, and set $THEOS_DEVICE_IP to said IP
Intended for Theos developers like myself who may move between several different networks and want to save the 30 seconds it takes to set the ip
The tdi folder needs to be put into your home directory (~)
tdi.sh can be put anywhere, except for inside the tdi folder (will break things because im lazy)
I'd reccomend putting export TD=<location of tdi.sh into your .bash_profile.
However you end up running tdi.sh, you need to run it as a source file. So, with bash, . tdi.sh, or, as a bash environment variable, . $TD
Customize the phone mac address. Plenty of ways to figure out your phone's MAC, not going to walk you through it. Paste this into macAddress in replacement of mine in tdi.c's main method.
If the program flips out, your phone probably isn't on the network, or hasn't pinged your pc or whatever. it gets complex. If you have fixes for my shit code feel free to PR them.
. $TD is a bit easier for me to type than digging through my phone, getting the ip, and manually typing that in as my THEOS_DEVICE_IP every time i swap networks
the .c file: parse arp -a output, find the line with the right mac address, and grab anything in parenthesis as the IP. Generate a bash script that sets the environment variable, since you can only set env variables from bash scripts, and only when they're run as source scripts, aka, not children of the shell, but as commands themselves.
the .sh file: cd to ~/tdi, compile the .c file, run it, run the bash file as source that was generated by the .c file.