Skip to content

Instantly share code, notes, and snippets.

@ZhDev
ZhDev / androidExternalStorage.java
Created January 2, 2013 13:27
Returns a set of paths (as Strings) to the volumes mounted in an android device as external storage (such as SD cards and pendrives)
private TreeSet<String> getMountedSdCards() {
String externalMain = Environment.getExternalStorageDirectory().getAbsolutePath();
TreeSet<String> mountPaths = new TreeSet<String>();
try {
Scanner scanner = new Scanner(new File("/proc/mounts"));
while (scanner.hasNext()) {
String line = scanner.nextLine();
if (line.startsWith("/dev/block/vold/")) {
String[] lineElements = line.split(" ");
@ZhDev
ZhDev / v1.sh
Created November 13, 2012 01:49
Get public IP address from command line
curl ifconfig.me