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
class NetworkUtils(private val context: Context) { | |
fun isConnected(): Boolean { | |
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
val activeNetwork: NetworkInfo? = cm.activeNetworkInfo | |
var result = false | |
if (activeNetwork != null) { | |
result = activeNetwork.isConnectedOrConnecting | |
} | |
return result | |
} |
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
#----- Create a Docker for cross-compilation -----# | |
mkdir build && cd $_ | |
docker run -it --rm -v `pwd`:/build golang:1.8.3 /bin/bash | |
#----- Inside docker -----# | |
go get github.com/elastic/beats | |
cd /go/src/github.com/elastic/beats/filebeat/ | |
git checkout v5.6.3 | |
GOARCH=arm go build | |
cp filebeat /build | |
exit |
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
for v in `docker images | tail -n +2 |grep -v -e "none\|syncer"|awk '{print $1}'` ; do docker pull $v; done; |