Skip to content

Instantly share code, notes, and snippets.

@shrwnsan
Last active October 14, 2020 23:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrwnsan/5633447 to your computer and use it in GitHub Desktop.
Save shrwnsan/5633447 to your computer and use it in GitHub Desktop.
Dreamhost .dotfiles
# Alias: Files & Folders
alias ls="ls --color=auto"
alias la="ls -aF"
alias lc="ls -lcr"
alias ld="ls -ld"
alias lk="ls -lSr"
alias ll="ls -lF"
alias lla="ls -al"
alias lm="ls -al | more"
alias lr="ls -lR"
alias lt="ls -ltr"
alias lu="ls -lur"
alias lw="ls -w"
alias lwa="ls -wa"
alias lx="ls -lXB"
alias mytree="find . -type d | sed -e 1d -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|-/' | more"
alias dusort="du -s -h * | sort -n"
alias cd..="cd .."
## a quick way to get out of current directory ##
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
alias cls="clear"
alias grep="grep --color=auto --exclude-dir=\.svn"
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias calc='bc -l'
# Copy files from {src} to {dest} recursively but ignore-existing
# Example: "cpr src dest"
alias cpr="rsync --ignore-existing --recursive --verbose"
# Make some possibly destructive commands more interactive.
alias cp="cp -i"
alias rm="rm -i"
alias mv="mv -i"
# Alias: Git
alias ga='git add'
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -m'
alias gca='git commit -am'
alias gcl='git clone'
alias gco='git checkout'
alias gd='git diff'
alias gdw='git wdiff'
alias gi='. /home/$USER/git-info.sh'
alias gf='git fetch'
alias gpl='git pull'
alias gm='git merge'
alias glog='git log'
alias gl='git lg2'
alias gl1='git lg1'
alias gp='git push'
alias gpo='git push origin'
alias gpom='git push origin master'
alias gs='git status'
# Overwrite local files on git pull
alias gplo='git fetch --all && git reset --hard origin/master'
# ~/.bash_profile: executed by bash(1) for login shells.
# Load .bashrc, containing non-login related bash initializations.
if [ -f ~/.bashrc ]; then
. ~/.bashrc;
fi
# Load bash-completion
if [ "$PS1" -a -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# for terminal colors
export TERM=xterm-color
export CLICOLOR=true
export LSCOLORS=GxDxHxAxCxegedafagacad
eval `dircolors ~/.dir_colors`
# ~/.bashrc: executed by bash(1) for non-login shells.
# Set the default editor to vim.
export EDITOR=nano
# Add bash aliases.
if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
fi
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
Cyan="\[\033[0;36m\]" # Cyan
White="\[\033[0;37m\]" # White
# Bold
BBlack="\[\033[1;30m\]" # Black
BRed="\[\033[1;31m\]" # Red
BGreen="\[\033[1;32m\]" # Green
BYellow="\[\033[1;33m\]" # Yellow
BBlue="\[\033[1;34m\]" # Blue
BPurple="\[\033[1;35m\]" # Purple
BCyan="\[\033[1;36m\]" # Cyan
BWhite="\[\033[1;37m\]" # White
# Underline
UBlack="\[\033[4;30m\]" # Black
URed="\[\033[4;31m\]" # Red
UGreen="\[\033[4;32m\]" # Green
UYellow="\[\033[4;33m\]" # Yellow
UBlue="\[\033[4;34m\]" # Blue
UPurple="\[\033[4;35m\]" # Purple
UCyan="\[\033[4;36m\]" # Cyan
UWhite="\[\033[4;37m\]" # White
# Background
On_Black="\[\033[40m\]" # Black
On_Red="\[\033[41m\]" # Red
On_Green="\[\033[42m\]" # Green
On_Yellow="\[\033[43m\]" # Yellow
On_Blue="\[\033[44m\]" # Blue
On_Purple="\[\033[45m\]" # Purple
On_Cyan="\[\033[46m\]" # Cyan
On_White="\[\033[47m\]" # White
# High Intensty
IBlack="\[\033[0;90m\]" # Black
IRed="\[\033[0;91m\]" # Red
IGreen="\[\033[0;92m\]" # Green
IYellow="\[\033[0;93m\]" # Yellow
IBlue="\[\033[0;94m\]" # Blue
IPurple="\[\033[0;95m\]" # Purple
ICyan="\[\033[0;96m\]" # Cyan
IWhite="\[\033[0;97m\]" # White
# Bold High Intensty
BIBlack="\[\033[1;90m\]" # Black
BIRed="\[\033[1;91m\]" # Red
BIGreen="\[\033[1;92m\]" # Green
BIYellow="\[\033[1;93m\]" # Yellow
BIBlue="\[\033[1;94m\]" # Blue
BIPurple="\[\033[1;95m\]" # Purple
BICyan="\[\033[1;96m\]" # Cyan
BIWhite="\[\033[1;97m\]" # White
# High Intensty backgrounds
On_IBlack="\[\033[0;100m\]" # Black
On_IRed="\[\033[0;101m\]" # Red
On_IGreen="\[\033[0;102m\]" # Green
On_IYellow="\[\033[0;103m\]" # Yellow
On_IBlue="\[\033[0;104m\]" # Blue
On_IPurple="\[\033[10;95m\]" # Purple
On_ICyan="\[\033[0;106m\]" # Cyan
On_IWhite="\[\033[0;107m\]" # White
# Various variables you might want for your PS1 prompt instead
Time12h="\T"
Time12a="\@"
Time24h="\t"
PathShort="\w"
PathFull="\W"
NewLine="\n"
Jobs="\j"
Username="`whoami`"
# This PS1 snippet was adopted from code for MAC/BSD I saw from: http://allancraig.net/index.php?option=com_content&view=article&id=108:ps1-export-command-for-git&catid=45:general&Itemid=96
# I tweaked it to work on UBUNTU 11.04 & 11.10 plus made it mo' better
export PS1=$IBlack$Time24h' '$Username@$HOSTNAME$Color_Off'$(git branch &>/dev/null;\
if [ $? -eq 0 ]; then \
echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
if [ "$?" -eq "0" ]; then \
# @4 - Clean repository - nothing to commit
echo "'$Green'"$(__git_ps1 " (%s)"); \
else \
# @5 - Changes to working tree
echo "'$IRed'"$(__git_ps1 " {%s}"); \
fi) '$BYellow$PathShort$Color_Off'\n\$ "; \
else \
# @2 - Prompt when not in GIT repo
echo " '$Yellow$PathShort$Color_Off'\n\$ "; \
fi)'
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM linux-c
TERM mach-color
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM dtterm
TERM xterm
TERM xterm-color
TERM xterm-debian
TERM rxvt
TERM screen
TERM screen-bce
TERM putty
TERM screen-w
TERM vt100
TERM Eterm
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;36 # directory
LINK 01;33 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
FIFO 40;33 # pipe
SOCK 01;35 # socket
DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file
# This is for files with execute permission:
EXEC 01;37;41
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
# If you use DOS-style suffixes, you may want to uncomment the following:
#.cmd 01;32 # executables (bright green)
#.exe 01;32
#.com 01;32
#.btm 01;32
#.bat 01;32
.tar 01;31 # archives or compressed (bright red)
.tgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
.zip 01;31
.z 01;31
.Z 01;31
.gz 01;31
.bz2 01;31
.deb 01;31
.rpm 01;31
.jar 01;31
# image formats
.jpg 01;35
.jpeg 01;35
.gif 01;35
.bmp 01;35
.pbm 01;35
.pgm 01;35
.ppm 01;35
.tga 01;35
.xbm 01;35
.xpm 01;35
.tif 01;35
.tiff 01;35
.png 01;35
.mov 01;35
.mpg 01;35
.mpeg 01;35
.avi 01;35
.fli 01;35
.gl 01;35
.dl 01;35
.xcf 01;35
.xwd 01;35
# audio formats
.ogg 01;35
.mp3 01;35
.wav 01;35
[user]
name = YOUR_NAME
email = YOUR_EMAIL
[core]
excludesfile = /home/YOUR_USERNAME/.gitignore_global
pager = less -r
[alias]
lg1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
lg2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
lg = !"git lg1"
s = status
a = !git add . && git status
au = !git add -u && git status
aa = !git add . && git add -u && git status
c = "commit"
cm = "commit -m"
cma = "commit -am"
wdiff = "diff --color-words"
[color]
ui = auto # covers diff = true, status = auto, branch = auto
interactive = auto
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
# Dev generated files #
#######################
.sass-cache
#!/bin/bash
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null
# Find base of git directory
while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done
# Show various information about this git directory
if [ -d .git ]; then
echo "== Remote URL: `git remote -v`"
echo "== Remote Branches: "
git branch -r
echo
echo "== Local Branches:"
git branch
echo
echo "== Configuration (.git/config)"
cat .git/config
echo
echo "== Most Recent Commit"
# git --no-pager log --max-count=1
#git --no-pager log --pretty=format:'%C(bold blue)%h%C(reset) %C(bold white)— %an%C(reset), %ar: %s' --graph -n5 --abbrev-commit
git --no-pager log --graph -n10 --abbrev-commit --pretty=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)'
echo
echo "Type 'git log' for more commits, or 'git show' for full commit details."
else
echo "Not a git repository."
fi
popd >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment