Skip to content

Instantly share code, notes, and snippets.

@darkstone
darkstone / toHex.md
Created September 27, 2018 04:48 — forked from FoxIvan/toHex.md
bytes to hex
  private final static char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
  
  public static String toHex(byte[] bytes) {
        char[] hexChars = new char[bytes.length * 2];
        for (int i = 0; i < bytes.length; i++) {
            int byteValue = bytes[i] & 0xFF;
            hexChars[i * 2] = HEX_ARRAY[byteValue >>> 4];
            hexChars[i * 2 + 1] = HEX_ARRAY[byteValue & 0x0F];
 }
@darkstone
darkstone / AndroidTestOrchestrator.java
Created September 21, 2018 13:13 — forked from tomkoptel/AndroidTestOrchestrator.java
Extracted AndroidTestOrchestrator class from orchestrator-1.0.2-beta1.apk
package android.support.test.orchestrator;
import android.app.Instrumentation;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build.VERSION;
import android.os.Bundle;
@darkstone
darkstone / tomcat7
Created February 12, 2014 16:57 — forked from clstokes/tomcat7
#
# Since I have to look this up every time...
#
# Add the following in /etc/default/tomcat7
#
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=9991"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"