Skip to content

Instantly share code, notes, and snippets.

View anis-campos's full-sized avatar
🎯
Focusing

Anis anis-campos

🎯
Focusing
View GitHub Profile
@anis-campos
anis-campos / NetworkUtils.kt
Created June 19, 2019 14:24
Checking network connectivity on Android before API Level 29
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
}
@anis-campos
anis-campos / cross-compile_filebeat_arm.sh
Last active December 15, 2018 22:25
Cross-compile Elastic Filebeat for ARM with docker. Works Raspberry Pi 2
#----- 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
@anis-campos
anis-campos / docker-update-images.sh
Created June 4, 2017 10:53
Update all docker images on DSM
for v in `docker images | tail -n +2 |grep -v -e "none\|syncer"|awk '{print $1}'` ; do docker pull $v; done;