Life with Open Source

GIT worktree

1. Fetch origin and tags git fetch --tags git fetch origin 2. Add work tree git worktree add -b <remote branch name> ../<new folder> origin/<remote branch name>

Linux ifconfig cheat sheet

Display link status & IP Addresses ifconfig Bring interface up ifconfig eth0 up Bring interface down ifconfig eth0 down Assign IP to device eth0 ifconfig eth0 Assign IP to device including netmask and broadcast ifconfig eth0 netmask broadcast Add IP as alias ifconfig eth0:1

Linux ip cheat sheet

Display link status ip link show Display ip addresses ip addr show Bring interface up ip link set eth0 up Bring interface down ip link set eth0 down Assign IP to device eth0 ip addr add dev eth0 Assign IP to device including netmask and broadcast ip addr add broadcast dev eth0 Delete IP from device ip addr del dev eth0 Add IP as alias ip addr add 192.

How to undo git local commit(s)

Before pushing changes if you want to change last commit(s) Soft reset git reset HEAD~ Your files are left as is, you can now modify, commit and push. Hard reset git reset --hard HEAD~ Your files will get reset to HEAD.

GIT workflow

1. Fork at 2. Clone it locally git clone<your name>/<repo name>.git 3. Configure username and email address git config 'Yogesh Sharma' git config '' 4. Add upstream git remote add upstream<remote name>/<repo name>`.git 5. Fetch & Merge upstream git fetch upstream git merge upstream/master 6. Commit & Push git commit git push 7. On make a pull request 8.

Backup freeotp

Setup android-tools on Fedora 25 Install Android tools sudo dnf install android-tools Setup udev rules sudo cp /usr/share/doc/android-tools/51-android.rules /etc/udev/rules.d/ Enable and Start adb sudo systemctl enable adb sudo systemctl start adb To backup adb backup -f ~/backup-org.fedorahosted.freeotp.adb org.fedorahosted.freeotp To Restore adb restore ~/backup-org.fedorahosted.freeotp.adb

Setup RPM Build ENV

Install required packages sudo yum install rpm-build redhat-rpm-config yum-utils Setup build environment mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros Download src rpm and save it to ~/rpmbuild/SRPMS/ Install build dependencies for package sudo yum-builddep <package> Build package rpmbuild --rebuild <package>.src.rpm

Install ARES Wizard on Kodi

To Install Ares Wizard: Start Kodi Goto SYSTEM > File Manager Select Add Source Select None Type the following select Done Highlight the box underneath Enter a name for this media Source, type ares and select OK Go back to your Home Screen Select SYSTEM Select Add-Ons Select Install from zip file Select ares Select Wait for Add-on enabled notification The Ares Wizard is now installed and can be accessed via the PROGRAMS (or Apps) menu from your home screen

Find KVM VM’s IP from Host

Create following function in your .bash_profile FIND_VMIP() { VM=$1 IP=$(arp -e | grep $(sudo virsh domiflist ${VM} |grep vnet| awk '{print $5}') | awk '{print $1}') echo "VM ${VM} has IP ${IP}" } Create an alias alias vmip=FIND_VMIP Reload .bash_profile source ~/.bash_profile Now run command vmip to find ip. Example: $ sudo vmip myvm VM myvm has IP

Bash Shortcuts

Command Control Shortcuts Shortcut Description Ctrl + l clear the screen Ctrl + s stops the output to the screen (for long running verbose command) Ctrl + q allow output to the screen (if previously stopped using command above) Ctrl + c terminate the command Ctrl + z suspend/stop the command Command Recall Shortcuts Shortcut Description Ctrl + r search the history backwards Ctrl + g escape from history searching mode Ctrl + p previous command in history (i.