Skip to content

Instantly share code, notes, and snippets.

View gabin8's full-sized avatar
:octocat:
PRO

Andrey gabin8

:octocat:
PRO
  • Ukraine
View GitHub Profile
@PasanBhanu
PasanBhanu / CheckNetwork.java
Last active July 25, 2023 13:28
Check Internet Connection in Android (API Level 29) Using Network Callback
/*
You need to call the below method once. It register the callback and fire it when there is a change in network state.
Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application.
*/
// You need to pass the context when creating the class
public CheckNetwork(Context context) {
this.context = context;
}
package test;
import android.arch.lifecycle.LiveData;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@nickbutcher
nickbutcher / MainActivity.java
Last active August 20, 2021 16:15
A quick sample of the new physics-based animation library added in Support Library 25.3.0 docs: https://developer.android.com/reference/android/support/animation/package-summary.html output: https://twitter.com/crafty/status/842055117323026432
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ultraon
ultraon / build.gradle
Last active August 19, 2020 18:10
Good example of the merged Jacoco code covarage Gradle configuration
apply plugin: 'com.android.application'
apply from: "$rootDir/coverage.gradle"
//...
android {
//...
buildTypes {
//...
debug {
@anggadarkprince
anggadarkprince / AppHelper.java
Last active May 2, 2023 22:39
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
@pyricau
pyricau / LeakSlackUploadService.java
Created May 9, 2015 00:03
Sending Leak Traces to a Slack Channel (and HipChat, see the comments)
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
@victorreyesh
victorreyesh / Aircrack Commands
Created September 12, 2013 03:36
Cracking WPA2 / WEP Wifi / Aircrack 10 seconds guide. For Mac OSX
//Install Macports.
//Install aircrack-ng:
sudo port install aircrack-ng
//Install the latest Xcode, with the Command Line Tools.
//Create the following symlink:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
//Figure out which channel you need to sniff:
sudo airport -s
sudo airport en1 sniff [CHANNEL]
@dtmilano
dtmilano / android-select-device
Last active November 29, 2023 09:29
Script to select one connected device or emulator when running adb
#! /bin/bash
#=====================================================================
# Selects an android device
# Copyright (C) 2012-2022 Diego Torres Milano. All rights reserved.
#
# The simplest way to invoke this script is creating a function like
# this one in your shell startup file:
#
# ```
# adb ()