Archive for Uncategorized

Get public ip

dig +short myip.opendns.com @resolver1.opendns.com

Leave a Comment

ubuntu 16 remote X11 network manager session

ssh -XY <ip address>

sudo nm-connection-editor

Leave a Comment

R managing duplicates

duplicated() – returns logical vector: TRUE if value appears in vector with lower index
given a vector of ids:
ids$dup = duplicated(ids)

add a “b” to the end of the duplicates
idstrans <- mapply(function(i,d) { if(d) { paste(i,”b”,sep = “”) } else { i } },ids$id,ids$dup)

Leave a Comment

android emulator command line tasks

to list the available targets:

android list targets

to create emulated device:

android create avd -n <name> -t <targetID>

to retrieve list of installed emulators:

android list avd

to start a emulator:

emulator -avd <name>

to install app on emulator:

adb -e install -r <name>.apk

more at:

http://developer.android.com/tools/devices/managing-avds-cmdline.html

Leave a Comment

Python list comprehensions

generate list of lists

This will generate a list of multiples for each number 1 through 10 up to 100

[ [ x for x in range(100) if x % n == 0 ] for n in range(1,10)]

Flatten a list of lists

L = [[‘one’,’two’,’three’],[‘second’,’first’,’last’,’forth’]]
[ K[i] for K in L for i in range(0,len(K)) ]

 

Leave a Comment