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];
}
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
# | |
# 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" |
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
val rivateKey = privateKeyAsText | |
.replace("-----BEGIN PRIVATE KEY-----\n", "") | |
.replace("-----END PRIVATE KEY-----", "") | |
.replace("\n", "") | |
.let { | |
val encodedKey = Base64.getDecoder().decode(it) | |
val kf = KeyFactory.getInstance("RSA") | |
val keySpec = PKCS8EncodedKeySpec(encodedKey) | |
kf.generatePrivate(keySpec) as RSAPrivateKey | |
} |
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
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; |
I hereby claim:
- I am darkstone on github.
- I am andriesfc (https://keybase.io/andriesfc) on keybase.
- I have a public key ASBD_eqO9VxEDfUUe3nNxrmLW_wf-A99AQNOYcYICy69Rgo
To claim this, I am signing this object:
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
fun serveCustomer(maybeCustomer: Customer?) { | |
maybeCustomer ?: return // simply return | |
greet(customer) | |
customer.pickTable() | |
giveMenuToCustomer(customer) | |
forgetAboutCustomer(customer) | |
} |