Saturday, August 9, 2014

Installing whatsapp without a google account

I have phones which I did not want to associate with a Google account, so installing applications is a bit of a pain without Google play.

Here are my notes to self in case I need to install or upgrade e.g. Whatsapp on those phones.

Plug in the source phone

./adb shell pm list packages | grep whatsapp
./adb shell pm path com.whatsapp
./adb pull /data/app/com.whatsapp-2.apk

Plug in the target phone

./adb install -r com.whatsapp-2.apk

Friday, August 8, 2014

Setting up Emacs Tramp on Windows and Cygwin

Working remotely using a Windows PC isn't much fun through plain ssh sessions. Therefore I finally got around setting up Emacs Tramp on Windows.

It should be simple, but I'm making notes here in case I have to do it again.

I started with instructions from David Starks-Browning:


- Extracted the tramp tar
- copy tramp*/lisp/*.el into /cygdrive/c/path/where/i/extracted/emacs/site-lisp/

Put the following in my ~/.emacs file:
    (require 'tramp)
Figuring out the location of .emacs on a Windows PC was best left to Emacs itself. Since it does expand ~ for home directory, I simply opened the file ~/.emacs in Emacs itself.

Cygwin configuration

I added the Windows emacs into my cygwin path. Simply adding in ~/.bashrc
  export PATH="$PATH:/cygdrive/c/path/where/i/extracted/emacs/bin" 
To get environment right in the Windows emacs, I started emacs from a Cygwin shell instead of the icon:
 bash$ runemacs 

Using Tramp

I always keep forgetting the Tramp path syntax, but it's just a slash and colon
C-x C-f /remotehost:


Tramp would hang on opening a file.
- Tried to verify ssh works properly from inside emacs, from M-x shell
M-x shell fails with "invalid argument" message.
- Switched to using M-x eshell
SSH would hang forever on a "pseudo terminal will not be allocated" message.
- ssh remotehost from an emacs shell would start but never enter the remote shell
- ssh -t remotehost would not work for forcing the tty allocation.
- discovered a fakecygpty tool at Emacswiki, which is a shim which makes the ssh believe it is being run interactively.
- From Emacswiki, I added this new ssh method into  ~/.emacs file

(eval-after-load "tramp"
       (add-to-list 'tramp-methods
                     (lambda (x)
                        ((equal x "sshx") "cygssh")
                        ((eq (car x) 'tramp-login-program) (list 'tramp-login-program "fakecygpty ssh"))
                        (t x)))
                     (assoc "sshx" tramp-methods)))
       (setq tramp-default-method "cygssh")))
- Set this fakecygpty-ssh method as the default for tramp in  ~/.emacs file
(setq tramp-default-method "sshx")