This file contains 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
function getmimetypefromstring($data) | |
{ | |
// Most image types can be determined in 25 bytes or less. | |
$data = substr($data, 0, 32); | |
$uri = 'data://application/octet-stream;base64,' . base64_encode($data); | |
return exif_imagetype($uri); | |
} |
This file contains 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
// Replace the MoPubViewFactory so we can return instances of MoPubView2 instead. | |
MoPubViewFactory.setInstance(new MoPubViewFactory() { | |
@Override | |
protected MoPubView internalCreate(final Context context) { | |
return new MoPubView2(context); | |
} | |
}); |
This file contains 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
Joes-MacBook-Pro-2:~ jhansche$ while [ true ]; do time bin/monitor-adb ; done | |
* daemon not running. starting it now on port 5037 * | |
* daemon started successfully * | |
adb is started | |
Thu Aug 18 19:15:54 EDT 2016 | |
error: no devices/emulators found | |
Thu Aug 18 19:33:18 EDT 2016 | |
adb is broken, restarting: | |
error: protocol fault (couldn't read status): Connection reset by peer | |
* daemon not running. starting it now on port 5037 * |
This file contains 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
#!/bin/sh -e | |
adb start-server || adb start-server | |
echo "adb is started" | |
date | |
while [ "$(adb shell echo 1)" ]; do sleep 5; done | |
date | |
echo "adb is broken, restarting:" |
This file contains 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
#!/bin/sh | |
# Usage: ./watch-fds.sh <application_id> [delay_secs = 5] | |
APP_ID=${1:?missing application id} | |
DELAY=$(( ${2:-5} )) | |
DEVICE_LIMIT=$(( $(adb shell ulimit -n) )) | |
WARN_THRESHOLD=$(( ${DEVICE_LIMIT} / 3 )) | |
echo "Will warn at ${WARN_THRESHOLD}" |