Guest User

Untitled

a guest
Jul 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1. ### Opt-in setup tweaks for your new system:
  2.  
  3. Profile:
  4. ```bash
  5. # Better `ls`
  6. export CLICOLOR=1
  7. export LSCOLORS=GxFxCxDxBxegedabagaced
  8. alias ls='ls -p'
  9.  
  10. # Better `grep`
  11. export GREP_OPTIONS='--color=auto'
  12.  
  13. # brew install prc
  14.  
  15. # Colorized `traceroute`, `tail`, `head` (requires prepending command with `grc`)
  16. source "`brew --prefix`/etc/grc.bashrc"
  17.  
  18. # Case-insensitive globbing (used in pathname expansion)
  19. shopt -s nocaseglob
  20.  
  21. # Append to the Bash history file, rather than overwriting it
  22. shopt -s histappend
  23.  
  24. # Autocorrect typos in path names when using `cd`
  25. shopt -s cdspell
  26.  
  27. source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
  28.  
  29. # Make Tab autocomplete regardless of filename case
  30. set completion-ignore-case on
  31.  
  32. # List all matches in case multiple possible completions are possible
  33. set show-all-if-ambiguous on
  34.  
  35. # Immediately add a trailing slash when autocompleting symlinks to directories
  36. set mark-symlinked-directories on
  37.  
  38. # Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
  39. [ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh
  40.  
  41. # IP addresses
  42. alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
  43. alias localip="ipconfig getifaddr en1"
  44. alias ips="ifconfig -a | grep -o 'inet6\? \(\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\|[a-fA-F0-9:]\+\)' | sed -e 's/inet6* //'"
  45.  
  46. # Enhanced WHOIS lookups
  47. alias whois="whois -h whois-servers.net"
  48.  
  49. # Flush Directory Service cache
  50. alias flush="dscacheutil -flushcache"
  51.  
  52. # Don’t clear the screen after quitting a manual page
  53. export MANPAGER="less -X"
  54.  
  55. # Make some commands not show up in history
  56. export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
  57.  
  58. # Automatically jump to your onelife directory from anywhere
  59. alias onelife='cd ~/onelife'
  60. ```
  61.  
  62. Mac plist settings (you can simply input each line into Terminal):
  63.  
  64. ```bash
  65. # Because Library is hidden by default:
  66. chflags nohidden ~/Library
  67.  
  68. # Mountain Lion forces the fluid scrolling animation when you hit space or page-down. This change
  69. # fixes that, but sometimes (as with the scroll behavior on Safari) the settings aren't applied globally.
  70. defaults write NSGlobalDomain AppleScrollAnimationEnabled -bool false
  71. # Hidden apps show translucently:
  72. defaults write com.apple.dock showhidden -bool true
  73. defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
  74. # Make Safari’s search banners default to Contains instead of Starts With
  75. defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
  76. # Enable the Develop menu and the Web Inspector in Safari
  77. defaults write com.apple.Safari IncludeDevelopMenu -bool true
  78. defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
  79. defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
  80. # Add a context menu item for showing the Web Inspector in web views
  81. defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
  82. # Disable the iTunes store link arrows
  83. defaults write com.apple.iTunes show-store-link-arrows -bool false
  84. # Enable Dashboard dev mode (allows keeping widgets on the desktop)
  85. defaults write com.apple.dashboard devmode -bool true
  86. # Enable the debug menu in Disk Utility
  87. defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
  88. defaults write com.apple.DiskUtility advanced-image-options -bool true
  89. # Re-enable backspace to go back in Safari, shift delete to forward.
  90. defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool YES
  91. ```
  92.  
  93. ### Visual Distinction for when you are SSH'd in Terminal
  94.  
  95.  
  96. To help prevent running errant code on production, it's darn handy to change your terminal theme when opening an ssh connection.
  97. This involves adding two bash functions, and choosing a suitable terminal theme.
  98.  
  99. Create a new theme for the ssh connection (I called it "SSH-theme" and gave it a red background). My main theme is called "Visor"
  100.  
  101. Add these functions to ~/.bashrc (for whatever reason, mine is actually called ~/.profile)
  102.  
  103. ```bash
  104. function tabc {
  105. NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi
  106. osascript -e "tell application "Terminal" to set current settings of front window to settings set "$NAME""
  107. }
  108.  
  109. function ssh {
  110. tabc "SSH-theme"
  111. /usr/bin/ssh "$@"
  112. tabc "Visor"
  113. }
  114. ```
Add Comment
Please, Sign In to add comment