Skip to content

Instantly share code, notes, and snippets.

@proclnas
Created October 1, 2018 17:45
Show Gist options
  • Save proclnas/dc60215930c68e28b94e823c6508fba7 to your computer and use it in GitHub Desktop.
Save proclnas/dc60215930c68e28b94e823c6508fba7 to your computer and use it in GitHub Desktop.
expo-get-ip.php
<?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