How to install Git on Android phone
Questioned myself, is it possible to create git repository on android phone, edit project files on android phone and then push these to remote repository? Appeared that it is possible and works really well!
In order to do that I have installed Termux, Termux:Api, Termux:Widget. It is important to install all three apps from one market - they exist in F-Droid и Android Play Market but the last one in Android Play costs $2 but in F-Droid - it is free.
Run Termux and install all necessary packages, allow access to file system:
pkg install git openssh termux-api
termux-setup-storage
Create project folder:
mkdir /storage/emulated/0/Documents/work
cd /storage/emulated/0/Documents/work
git init
git remote add origin git@github.com:username/reponame.git
git config --global user.email "your@email.com"
git config --global user.name "Max"
nano readme.md
git add readme.md
git commit -am"first commit"
#create keys pair:
ssh-keygen
cat /data/data/com.termux/files/home/.ssh/id_rsa.pub
#copy the public key into the remote folder.
Creating folder with startup scripts:
mkdir -p $HOME/.shortcuts
mkdir -p /data/data/com.termux/files/home/.shortcuts/tasks
cd /data/data/com.termux/files/home/.shortcuts/
nano ./push.sh
chmod +x push.sh
push.sh looks like this:
#!/data/data/com.termux/files/usr/bin/bash
cd /storage/emulated/0/Documents/work
git add *
git commit -am"autocommit"
git push origin master
termux-toast "Changes successfully pushed"
Create pull.sh:
#!/data/data/com.termux/files/usr/bin/bash
cd /storage/emulated/0/Documents/work
git pull origin master
termux-toast "Changes successfully pulled"
Add the widget on our screen and use it to trigger pull и push scripts from there!
Now I can push and pull changes from my phone screen!
Floating point precision
Found interesting thing in Raimond Hattinger twitter for Python.
It works also in Javascript:
var x = 12345678901234567.0
console.log(x === x + 1); //true
Interactive Vim Tutorial
Found very simple Interactive Vim Tutorial. If you want to grab some Vim magic - really recommend it.
Leetcode 30 challenge
The best usage of time during quarantine is developing your coding skills in 30 Leetcode Challenge - I love it, just select your favorite programming language and solve tasks. It is super helpful if you are software engineer or just love programming.