Skip to content

Instantly share code, notes, and snippets.

@ChristopherA
Last active October 1, 2016 07:44
Show Gist options
  • Save ChristopherA/bf328ce5cde2990d421a7a42bc6ac662 to your computer and use it in GitHub Desktop.
Save ChristopherA/bf328ce5cde2990d421a7a42bc6ac662 to your computer and use it in GitHub Desktop.
Various useful ideas for dotfiles

shell files

at end of .bashrc

source $HOME/.bashrc_$(hostname -f)

alias completion

https://github.com/goude/runcom/blob/master/bash/fix_alias_completion.bash

brew formulas list

http://brewformulas.org/

cask search

https://caskroom.github.io/search

mas

like brew cask but for Mac App Store files

https://github.com/argon/mas

Install Ruby and verify signature

Install RVM

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Install stable ruby (gems are optional)

\curl -sSL https://get.rvm.io | bash -s stable --ruby --gems=rails,puma

Hardening

brew

brew analytics off
https://github.com/Homebrew/brew/blob/master/docs/Analytics.md

filevault

fileVaultOn () {
  echo ""
  echo "Enabling FileVault..."
  echo "> The next steps will guide you through setting up the encryption."
  echo "> Write down the key as it will enable you to recover your disk incase"
  echo "> you forget your password. Lastyl, you'll need to reboot your mac for"
  echo "> changes to take effect."
  echo ""
  sudo fdesetup enable
}

logout() {
  echo "Skipping Disk Encryption, logging you out for changes to take effect."
  sleep 1
  osascript -e 'tell application "System Events" to log out'
  builtin logout
}

echo "Checking if FileVault Disk Encryption is enabled"
fileVaultStatus="fdesetup isactive"
if ! $fileVaultStatus; then
  while true; do
    echo ""
    read -p "Enable Disk Encryption: Turn FileVault On? [y/n] " FILEVAULT
    case $FILEVAULT in
      [y/Y]* ) fileVaultOn; break;;
      [n/N]* ) logout; break;;
      * ) echo "Please answer Y or N";;
    esac
  done
else
  echo "FileVault is Activated"
fi

emulating pbcopy pbpaste in linux

from https://github.com/Bash-it/bash-it/blob/master/aliases/available/clipboard.aliases.bash

cite 'about-alias'
about-alias 'pbcopy and pbpaste shortcuts to linux'

case $OSTYPE in
  linux*)
    XCLIP=$(command -v xclip)
    [[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o"
    ;;   
esac

# to use it just install xclip on your distribution and it would work like:
# $ echo "hello" | pbcopy
# $ pbpaste
# hello

# very useful for things like:
# cat ~/.ssh/id_rsa.pub | pbcopy
# have fun!

Composure

Consider converting to scripts to composure.

https://github.com/erichs/composure/

git-tree

https://chr4.org/blog/2014/09/10/gittree-bash-slash-zsh-function-to-run-git-commands-recursively/

.dotfiles to investigate for good ideas (in rough order of priority)

https://github.com/kdeldycke/dotfiles/blob/master/dotfiles-common/.bash_profile

https://gist.github.com/brandonb927/3195465 https://gist.github.com/matthewmueller/e22d9840f9ea2fee4716

https://gist.github.com/kevinelliott/7a152c556a83b322e0a8cd2df128235c

https://gist.github.com/gjpalau/f30fbf432ab62540ece0#file-macrenamer-sh https://gist.github.com/gjpalau/500258474096dbaf83b4 https://gist.github.com/gjpalau/f15eea9a8f2c2dd85f97

https://github.com/twish/dotfiles/blob/master/install.sh

https://gist.github.com/gjpalau/9d0e01746a78cee5ebb3

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