Skip to content

Instantly share code, notes, and snippets.

@yhs0602
Created February 22, 2020 00:27
Show Gist options
  • Save yhs0602/16c1b9ced9cc39baa3b8f48158a8dc2b to your computer and use it in GitHub Desktop.
Save yhs0602/16c1b9ced9cc39baa3b8f48158a8dc2b to your computer and use it in GitHub Desktop.
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

export ASP=/mnt/c/Users/82102/AndroidStudioProjects/ 
export PATH=$PATH:/mnt/c/Windows
export PATH=$PATH:"/mnt/c/Program Files/Java/jdk-12/bin"
export PATH=$PATH:"/mnt/c/Program Files/Java/jdk-12"
export PATH=$PATH:"/mnt/c/Users/82102/AppData/Local/Android/Sdk/tools"
export WINHOME=/mnt/c/Users/82102/
export DOCUMENTS=/mnt/e/82102/Documents/
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
alias explorer='explorer.exe'
alias la='ls -la'
alias gimmit='git commit'
alias gish='git push'
alias gull='git pull'
alias java='java.exe'
alias emulator='emulator.exe'
alias emulatorr='emulator -avd Nexus6LollipopRoot -writable-system'
alias cdand='cd $ASP'
alias "/mnt/c/Program Files/Java/jdk-12/bin/java" "/mnt/c/Program Files/Java/jdk-12/bin/java.exe"
@yhs0602
Copy link
Author

yhs0602 commented Feb 22, 2020

To open wsl using context menu
install this to registry

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Open Terminal]
@="Open terminal here"
"Icon"="C:\\cygwin64\\bin\\mintty.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Open Terminal\command]
@="cmd /c start wt"

@yhs0602
Copy link
Author

yhs0602 commented Feb 22, 2020

Make linux shell as default, and make current path apply to launching wsl, use this settings


// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
  "$schema": "https://aka.ms/terminal-profiles-schema",

  "defaultProfile": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}",

  "profiles": [
    {
      // Make changes here to the powershell.exe profile
      "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
      "name": "Windows PowerShell",
      "commandline": "powershell.exe",
      "hidden": false
    },
    {
      // Make changes here to the cmd.exe profile
      "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
      "name": "cmd",
      "commandline": "cmd.exe",
      "hidden": false
    },
    {
      "guid": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}",
      "hidden": false,
      "name": "kali-linux",
      "source": "Windows.Terminal.Wsl",
      "startingDirectory": "%__CD__%"
    },
    {
      "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
      "hidden": false,
      "name": "Azure Cloud Shell",
      "source": "Windows.Terminal.Azure"
    }
  ],

  // Add custom color schemes to this array
  "schemes": [],

  // Add any keybinding overrides to this array.
  // To unbind a default keybinding, set the command to "unbound"
  "keybindings": []
}

@yhs0602
Copy link
Author

yhs0602 commented Feb 22, 2020

fake java:

#!/bin/bash
toto="C:"
pattern="/mnt/c"
arr=()
for var in "$@"
do
    arr+=("${var/$pattern/$toto}")
done
res="${arr[*]}"
echo $res
java.exe $res

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment