Thursday, September 26, 2019

Avoid showing a/b prefix in git diff



Set the config option diff.noprefix:
$ git config --global diff.noprefix true    # All repos
$ git config diff.noprefix true             # Current repo

Backups done right - restic



restic
  - a backup program that is fast, efficient and secure.


Web: https://restic.net

github: https://github.com/restic/restic

Documentation: https://restic.readthedocs.io/en/stable/

Quickstart: https://restic.net/#quickstart



Thursday, September 19, 2019

Vagrant + libvirt in Fedora


Vagrant
 
   from https://www.vagrantup.com

--

Install libvirt and qemu:
   dnf -y install qemu libvirt libvirt-devel ruby-devel gcc
  source: https://github.com/vagrant-libvirt/vagrant-libvirt#possible-problems-with-plugin-installation-on-linux
    Install vagrant:
        https://www.vagrantup.com/docs/installation/index.html
        https://www.vagrantup.com/downloads.html


    Install vagrant plugin for libvirt:
    vagrant plugin install vagrant-libvirt
    --
    To list all the plugins:
      vagrant plugin list

    To repair the plugins if you run into issues:
     vagrant plugin repair

    To update the plugin:
      vagrant plugin update 
    --
    First init the Vagrantfile
    vagrant init fedora/29-cloud-base

    // Note: You can check whether the corresponding image present here
    // https://app.vagrantup.com/fedora

    --

    // without any specific OS:
    vagrant init

    You need to update Vagrant file with specific OS before proceeding.

    --
    To create and configure and to bring up the VM
    vagrant up --provider=libvirt

    --

    You can find your downloaded box here:
    ls ~/.vagrant.d/boxes/

    --

    vagrant status
    // only for current directory
    --

    vagrant global-status
    // global for this user
    --

    vagrant halt  <id>

    id is received in global-status command above
    --

    To start again:
    vagrant provision

    or  you can run the same command as:
    vagrant up --provision 

    You can also avoid running it by
    vagrant up --no-provision 

    --
    // To login
    vagrant ssh

    --

    // To destroy specific box

    vagrant destroy

    // Note, the above will not remove the box from the system (from backend). 
    // To remove it you can use

    vagrant box remove  

    --

    // remembers the state saving the state of VM
    vagrant suspend

    // To resume back
    vagrant resume

    --

    // To stop:
    vagrant halt
    --

    // List all the boxes in your system:
    vagrant box list

    --

    // To share files between host and VM

    // option in Vagrantfile
      config.vm.synced_folder "../data", "/vagrant_data"

    Here ../data => directory in Host
    /vagrant_data => directory in VM

    Ensure you have working NFS server in host.
    Also, udp=y in /etc/nfs.conf in the host machine.

    --

    vagrant reload ->  vagrant halt + vagrant up

    // along with provision
    vagrant reload --provision

    --

    // provider specific changes in Vagrantfile
       vb.memory = "value"
       vb.cpus = "value"

    --

    // to package a new vagrant box
    vagrant package

    --

    Refer this gist for additional info:
     


    Wednesday, September 11, 2019

    Wednesday, September 4, 2019

    xz file extraction



    Just like using "unzip" command for zip files, you can use "unxz "   for xz files.

    No need to remember -xJf   option ;)