Sunday, December 22, 2013

Each.withIndex

Sunday, December 8, 2013

Inverting the git index

I wanted to find a way to invert the git index (swap the staged and unstaged files in the index). There were some answers on stackoverflow but the best I found initially required an interactive rebase to reorder the commits.

http://stackoverflow.com/questions/14628830/git-invert-staging-area/20458127#20458127

Then I found another answer about how to use tags to invert commits. This is ultimately what I'm using now by putting both answers together:

Wednesday, December 4, 2013

Android multi-user sdcard access

I haven't found the documented way to see the sdcard content for different users on a multi-user android  nexus7 using adb  (suppose I need to see some debug logs). However I did find this:

cd /storage/sdcard0
ls ..

What is listed is not actually the content of  /storage. There are listings for user 0 (root) and user 10 (the other user). You can confirm this with ps, you'll see processes prefixed with u0_ and u10_.

So:
ls ../0 lists the tablet owner's files
ls ../10 lists the other user's files

You can also copy files from there.

cp ../10/Download/somefile .

Note: Even tab autocompletion works too.