Skip to content

Instantly share code, notes, and snippets.

@chiuki
chiuki / CheckCN.java
Created May 2, 2017 15:50
Check the CN of a certificate from a server. The certificate can be self-signed, and the server does not have to be HTTP.
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.SocketFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
@chiuki
chiuki / uninstall_instrumentation_tests.sh
Created November 29, 2017 16:51
Script to remove instrumentation tests
#!/bin/bash
for p in `adb shell pm list instrumentation | cut -f2 -d: | cut -f1 -d/`; do
echo -n "Uninstalling $p... "
adb uninstall $p
done
@chiuki
chiuki / .bashrc
Last active October 25, 2023 18:33
Bash prompt with time, path, git branch and exit status
function prompt_command {
exitstatus="$?"
BOLD="\[\033[1m\]"
RED="\[\033[1;31m\]"
GREEN="\[\e[32;1m\]"
BLUE="\[\e[34;1m\]"
PURPLE="\[\e[35;1m\]"
CYAN="\[\e[36;1m\]"
OFF="\[\033[m\]"