Termux (terminal emulator for Android)

Install jupyter

pkg upgrade
# Install runtime deps
pkg install python libzmq libcrypt

# Add build deps
pkg install python-dev libzmq-dev libcrypt-dev clang  
pip3 install -U pip
pip3 install pyzmq --install-option="--zmq=/usr/lib"
pip3 install jupyter

# Remove build deps and pip cache
apt remove python-dev libzmq-dev libcrypt-dev clang
apt autoremove
rm .cache ../usr/var/cache -rf

#TODO: Clean up ~200 mb pulled by build...

SSH

# Set up passwd
passwd

# Install and run openssh
pkg upgrade
pkg install openssh
sshd

# config passwd Aythentication
cat $PREFIX/etc/ssh/sshd_config
# Must have:
# PrintMotd yes
# PasswordAuthentication yes
# Subsystem sftp /data/data/com.termux/files/usr/libexec/sftp-server

# Generate the key
ssh-keygen -t rsa -b 2048 -f id_rsa

# Copy key to the remote machine
ssh-copy-id -p 8022 -i id_rsa IP_ADDRESS

# Log into termux
ssh -p '8022' '$IP'

Backup and Restore

# Backup
# Ensure that storage permission is granted:
termux-setup-storage

# Backing up files:
tar -zcf /sdcard/termux-backup.tar.gz -C /data/data/com.termux/files ./home ./usr

# Restore
# Ensure that storage permission is granted:
termux-setup-storage

# Extract home and usr with overwriting everything. Pass --recursive-unlink to remove any junk and orphaned files. Pass --preserve-permissions to set file permissions as in archive, ignoring the umask value. By combining these extra options you will get installation state exactly as was in archive.
tar -zxf /sdcard/termux-backup.tar.gz -C /data/data/com.termux/files --recursive-unlink --preserve-permissions

Enable copy and paste for vim in termux

if executable('termux-clipboard-set')
    vnoremap <C-x> :!termux-clipboard-set<CR>
    vnoremap <C-c> :w !termux-clipboard-set<CR><CR>
    inoremap <C-v> <ESC>:read !termux-clipboard-get<CR>i
endif