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 192.168.0.2 Assign IP to device including netmask and broadcast ifconfig eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.1 Add IP as alias ifconfig eth0:1 192.168.1.2

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 192.168.0.2 dev eth0 Assign IP to device including netmask and broadcast ip addr add 192.168.0.2/24 broadcast 192.168.0.255 dev eth0 Delete IP from device ip addr del 192.168.0.2/24 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 github.com 2. Clone it locally git clone git@github.com:<your name>/<repo name>.git 3. Configure username and email address git config user.name 'Yogesh Sharma' git config user.email 'Yogesh.Sharma@xyz.com' 4. Add upstream git remote add upstream git@github.com:<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 github.com 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 http://www.areswizard.co.uk 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 script.areswizardx.x.xx.zip 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 192.168.122.178

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.