Sunday, October 28, 2018

Listing only directories in linux


ls -d */

Install android apk using adb with all permissions granted by default


adb install -g myAndroidApplication.apk

Clear android Application data using shell command


adb shell pm clear com.app.packageName

Reset a specific permission of android package


adb shell pm revoke com.app.packageName android.permission.WRITE_EXTERNAL_STORAGE

Reset all granted permissions to a android package


adb shell pm reset-permissions -p com.app.packageName

Get environment variables passed to android/linux process


adb shell cat /proc/238/environ | sed -e "s/\x0/\n/g"

Pass environment variables to pythons using sudo while invoking it


  • sudo -E PYTHONPATH=${PYTHONPATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} python
  • Set/Get global android device settings using command line


  • adb shell settings put global bluetooth_disabled_profiles 6
  • adb shell settings put global device_provisioned 1
  • adb shell settings list global
  • adb shell settings list system
  • adb shell settings list secure
  • adb shell settings get global bluetooth_on
  • 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


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