(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
import android.content.Context; | |
import android.os.Debug; | |
import java.io.File; | |
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler { | |
private static final String FILENAME = "out-of-memory.hprof"; | |
public static void install(Context context) { | |
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); |
public class AndroidApplication extends MultiDexApplication { | |
public static final String TAG = AndroidApplication.class.getSimpleName(); | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
registerComponentCallbacks(new ComponentCallback()); | |
} | |
private class ComponentCallback implements ComponentCallbacks2 { |
# ----------------------------------------------- | |
# BEFORE USING THIS SCRIPT | |
# ----------------------------------------------- | |
# 1 - Create a file in /etc/<yourpassfile>.pass which contains the vpn private key password. | |
# 2 - Set permission for the file: 'sudo chmod 600 /etc/<yourpassfile>.pass' - Owner can read and write. | |
# 3 - Create an alias in your .bashrc or bash_profile: alias vpn="sudo sh <path to your script>". | |
# 4 - Set the value of the variable OVPN_FILE_PATH with the path of the .ovpn file. | |
# 5 - Set the value of the variable OVPN_PRIVATE_KEY_FILE_PATH with the path of the created file in step #1: /etc/<yourpassfile>.pass | |
# 6 - OPTIONAL: avoid password when executing the script, add this to /etc/sudoers '<your username> ALL=(ALL:ALL) NOPASSWD:<path to your script>' |
def getVersionName = { -> | |
def hashStdOut = new ByteArrayOutputStream() | |
exec { | |
commandLine "git", "rev-parse", "--short", "HEAD" | |
standardOutput = hashStdOut | |
} | |
def buildNumberStdOut = new ByteArrayOutputStream() | |
exec { | |
commandLine 'echo', "$BUILD_NUMBER" |