Skip to content

Latest commit

 

History

History

macosx

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

macOSX

  1. Open finder at place from terminal

    open .
    
  2. Command to change the destination folder to save your screenshots in mac

    defaults write com.apple.screencapture location ~/Pictures/Screenshots
    killall SystemUIServer
    
  3. stop_android_filetransfer_popup.sh - Stop the auto popup of Android FileTransfer Window when you plug in your device

  4. Get DSA public key of system

    #More info at : https://help.github.com/articles/generating-ssh-keys/
    cat ~/.ssh/id_dsa.pub
    
  5. Disable Google Chrome’s Two-Finger Swipe Navigation

    defaults write com.google.Chrome.plist AppleEnableSwipeNavigateWithScrolls -bool FALSE
    
  6. Make your mac os talk

    say "This Mac runs OS X, not OS ex"
    
  7. Make your mac os read(verbally) a text file

    say -f /path/to/file.txt
    
  8. Get External IP

    curl ipecho.net/plain; echo
    
  9. Get network ip

    ipconfig getifaddr en0
    
  10. Test network connectivity

    ping -c 10 www.google.com
    

Aliases

How to setup these aliases

  • Copy-Paste these alias inside your .bashrc or .zshrc
  • Save.
  • Goto terminal and execute source ~/.bashrc or source ~/.zshrc.
  • Done, now simply call the alias to execute the command as defined.
# ------------------ Shell ---------------- #
# Get default/current shell name
function currentShell(){
  local CURRENT_SHELL_NAME=$SHELL;

  if [[ "$CURRENT_SHELL_NAME" == "-"* ]]; then
    # Returned name is of type: -bash
    # Sanitize the result by removing "-"
    CURRENT_SHELL_NAME=$(echo $CURRENT_SHELL_NAME | cut -d '-' -f 2);
  fi

  if [[ "$CURRENT_SHELL_NAME" == "/usr/bin/"* ]]; then
    # Returned name is of type: /usr/bin/bash
    # Sanitize the result by removing "/usr/bin/"
    CURRENT_SHELL_NAME=$(echo $CURRENT_SHELL_NAME | awk -F'/' '{print $4}');
  fi

  if [[ "$CURRENT_SHELL_NAME" == "/bin/"* ]]; then
    # Returned name is of type: /bin/bash
    # Sanitize the result by removing "/bin/"
    CURRENT_SHELL_NAME=$(echo $CURRENT_SHELL_NAME | awk -F'/' '{print $3}');
  fi

  echo $CURRENT_SHELL_NAME;  
}

# Reset/Reload your current/default shell 
alias resetTerminal="exec $(currentShell)"

# Open the default shell's rc file for defining configuration 
alias shellConfig="code ~/.$(currentShell)rc"

License

Copyright 2016 Nishant Srivastava

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.