Created
October 1, 2018 17:45
-
-
Save proclnas/dc60215930c68e28b94e823c6508fba7 to your computer and use it in GitHub Desktop.
expo-get-ip.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// REACT_NATIVE_PACKAGER_HOSTNAME=$(ifconfig | awk '/wlp2s0/{getline; print}' | php get-ip.php) npm start | |
echo array_values( | |
array_filter( | |
explode(' ', fgets(STDIN)), | |
function($var){ | |
if ( | |
preg_match('#\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b#', | |
$var, | |
$match) | |
) { | |
return inet_pton($match[0]); | |
} | |
} | |
) | |
)[0]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment