Sunday, October 28, 2018

Trim leading and trailing whitespace using sed


sed -i 's/^[ \t]*//;s/[ \t]*$//' filename

Create simple webserver in python


To create simple web server in python run below command in shell
python -m SimpleHTTPServer 5000
this will start serving pages at the address http://localhost:5000 and will show files from the location from where command is ran.

How to set/unset Windows 10 to boot in safe mode using command prompt


After reboot press ESC then F11 to enter system recovery mode, then select Troubleshooting then "Advanced Options" then "Command Prompt".
  • After command prompt appears type following
    bcdedit /set {default} safeboot minimal and press Enter. or
    bcdedit /set {default} safeboot network and press Enter. or
    bcdedit /set {default} safebootalternateshell yes and press Enter.
  • Close command prompt
  • On "Choose an option" screen press Continue

    To Unset the safe mode booting, follow above steps till command prompt and then enter command
    bcdedit /deletevalue {default} safeboot and press Enter.
  • Saturday, August 25, 2018

    Sher


    लाजवाब है मेरी जिंदगी का फसाना,
    कोई सीखे मुझसे हर पल मुस्कुराना,
    पर कोई मेरी हंसी को नजर न लगाना,
    बहुत दर्द सहकर सीखा है मुस्कुराना....!!!!

    Friday, August 12, 2016

    Split single line into multiple lines separated with ;

    cat t.txt | xargs | sed 's/;/\n/g'

    Combine multiple lines into single line separated using ;

    cat t.txt |xargs | sed -e 's/\n/;/g'

    How to get print from android makefile

    Add below line to get print from android makefile
    $(info "I want this print")