-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split up files and add install script
- Loading branch information
1 parent
4e3b7f1
commit 995a125
Showing
13 changed files
with
585 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Navigation | ||
alias ..="cd .." | ||
alias ...="cd ../.." | ||
alias ....="cd ../../.." | ||
alias .....="cd ../../../.." | ||
|
||
# Folder shortcuts | ||
alias dx="cd ~/Dropbox" | ||
alias dt="cd ~/Desktop" | ||
alias pr="cd ~/Projects" | ||
|
||
alias c="clear" | ||
alias ls="ls -lsG" | ||
|
||
# Show/hide hidden files in Finder | ||
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" | ||
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" | ||
|
||
# Hide/show all desktop icons | ||
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" | ||
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" | ||
|
||
# Ring the terminal bell, and put a badge on Terminal’s Dock icon | ||
alias badge="tput bel" | ||
|
||
# Lock the screen (when going AFK) | ||
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" | ||
|
||
# Kill all the tabs in Chrome to free up memory | ||
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
# Load .profile and .bashrc | ||
#!/usr/bin/env bash | ||
|
||
if [ -f "$HOME/.profile" ]; then | ||
. "$HOME/.profile" | ||
fi | ||
|
||
if [ -f "$HOME/.bashrc" ]; then | ||
. "$HOME/.bashrc" | ||
fi | ||
for file in ~/.{bashrc,bash_prompt,aliases,functions,secrets,extras}; do | ||
[ -r "$file" ] && [ -f "$file" ] && source "$file"; | ||
done; | ||
unset file; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Parse current branch | ||
parse_git_branch() { | ||
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | ||
} | ||
|
||
# Custom Prompt | ||
PROMPT_COMMAND='custom_prompt' | ||
custom_prompt() { | ||
exit_code=$? | ||
|
||
bash_version=$(echo $BASH_VERSION | sed -e 's/\([0-9.]*\)(.*/\1/') | ||
window_title="Bash $bash_version – $(pwd | grep -o '[^/]\+$')" | ||
msg=${debian_chroot:+($debian_chroot)} | ||
|
||
if [[ $exit_code -ne 0 ]]; then | ||
msg="\[\e[31m\] ✘ exit $exit_code\[\e[0m\]\n$msg" | ||
fi | ||
|
||
reset_colour="\[\e[0m\]" | ||
date="\[\e[32m\][\d \$(date +%k:%M:%S)] " | ||
user="${reset_colour}\u" | ||
at="\[\e[97m\]@" | ||
host="\[\e[36m\]\h " | ||
git="\[\e[32m\]$(parse_git_branch)" | ||
dir="\[\e[33m\]\w${git} \[\e[33m\]❯ " | ||
|
||
PS1="${msg}${date}${user}${at}${host}${dir}${reset_colour}" | ||
|
||
echo -n -e "\033]0;$window_title\007" | ||
} | ||
|
||
# For fun | ||
# if which fortune boxes lolcat &> /dev/null; then | ||
# echo | ||
# fortune -s | boxes -d simple -p a1l3r3 | lolcat -F 0.5 | ||
# echo | ||
# fi | ||
|
||
# if which figlet lolcat boxes &> /dev/null; then | ||
# figlet -f ogre -w 150 "hello" $USER | boxes -d simple -p a1l3r3 | ||
# echo | ||
# fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Test for non-interactive shells | ||
[[ $- == *i* ]] || return 0 | ||
|
||
# Load bits | ||
eval "$(rbenv init -)" | ||
|
||
export PATH=/usr/local/bin:$PATH | ||
|
||
|
||
# Open man page as PDF | ||
function manpdf() { | ||
man -t "${1}" | open -f -a /Applications/Preview.app/ | ||
} | ||
|
||
# Create a new directory and enter it | ||
function mk() { | ||
mkdir -p "$1" && cd "$1" | ||
} | ||
|
||
# Change into the top-most Finder window's location | ||
function cdf() { # short for `cdfinder` | ||
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')" | ||
} | ||
|
||
# With no arguments opens the current directory in Atom, otherwise | ||
# opens the given location | ||
function a() { | ||
if [ $# -eq 0 ]; then | ||
atom . | ||
else | ||
atom "$@" | ||
fi | ||
} | ||
|
||
|
||
# Navigation | ||
alias ..="cd .." | ||
alias ...="cd ../.." | ||
alias ....="cd ../../.." | ||
alias .....="cd ../../../.." | ||
|
||
# Folder shortcuts | ||
alias dx="cd ~/Dropbox" | ||
alias dt="cd ~/Desktop" | ||
alias pr="cd ~/Projects" | ||
|
||
alias c="clear" | ||
alias ls="ls -lsG" | ||
|
||
# Show/hide hidden files in Finder | ||
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" | ||
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" | ||
|
||
# Hide/show all desktop icons | ||
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" | ||
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" | ||
|
||
# Ring the terminal bell, and put a badge on Terminal’s Dock icon | ||
alias badge="tput bel" | ||
|
||
# Parse current branch | ||
parse_git_branch() { | ||
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | ||
} | ||
|
||
|
||
# Custom Prompt | ||
PROMPT_COMMAND='custom_prompt' | ||
custom_prompt() { | ||
exit_code=$? | ||
|
||
bash_version=$(echo $BASH_VERSION | sed -e 's/\([0-9.]*\)(.*/\1/') | ||
window_title="Bash $bash_version – $(pwd | grep -o '[^/]\+$')" | ||
msg=${debian_chroot:+($debian_chroot)} | ||
|
||
if [[ $exit_code -ne 0 ]]; then | ||
msg="\[\e[31m\] ✘ exit $exit_code\[\e[0m\]\n$msg" | ||
fi | ||
|
||
reset_colour="\[\e[0m\]" | ||
date="\[\e[32m\][\d \$(date +%k:%M:%S)] " | ||
user="${reset_colour}\u" | ||
at="\[\e[97m\]@" | ||
host="\[\e[36m\]\h " | ||
git="\[\e[32m\]$(parse_git_branch)" | ||
dir="\[\e[33m\]\w${git} \[\e[33m\]❯ " | ||
|
||
PS1="${msg}${date}${user}${at}${host}${dir}${reset_colour}" | ||
|
||
echo -n -e "\033]0;$window_title\007" | ||
} | ||
|
||
|
||
# For fun | ||
if which fortune boxes lolcat &> /dev/null; then | ||
echo | ||
fortune -s | boxes -d simple -p a1l3r3 | lolcat -F 0.5 | ||
echo | ||
fi | ||
|
||
# if which figlet lolcat boxes &> /dev/null; then | ||
# figlet -f ogre -w 150 "hello" $USER | boxes -d simple -p a1l3r3 | ||
# echo | ||
# fi | ||
if which rbenv &> /dev/null; then eval "$(rbenv init -)"; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
export HISTCONTROL=ignoreboth # Forget duplicate and space-prefixed commands. | ||
export HISTFILESIZE=1000 # Maximum number of commands saved in .bash_history. | ||
export HISTSIZE=500 # Maximum number of commands to remember from one session. | ||
|
||
# Enable colour for 'grep' output | ||
export GREP_OPTIONS="--color=auto" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Open man page as PDF | ||
function manpdf() { | ||
man -t "${1}" | open -f -a /Applications/Preview.app/ | ||
} | ||
|
||
# Create a new directory and enter it | ||
function mk() { | ||
mkdir -p "$1" && cd "$1" | ||
} | ||
|
||
# Change into the top-most Finder window's location | ||
function cdf() { # short for `cdfinder` | ||
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')" | ||
} | ||
|
||
# With no arguments opens the current directory in Atom, otherwise | ||
# opens the given location | ||
function a() { | ||
if [ $# -eq 0 ]; then | ||
atom . | ||
else | ||
atom "$@" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
[user] | ||
name = Daniel Swaine | ||
email = [email protected] | ||
|
||
[core] | ||
excludesfile = ~/.globalgitignore | ||
editor = atom | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.