Skip to content

Instantly share code, notes, and snippets.

@yashh
Last active June 4, 2019 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashh/1544881 to your computer and use it in GitHub Desktop.
Save yashh/1544881 to your computer and use it in GitHub Desktop.
bash_profile and aliases
###########
# GENERAL #
###########
alias ..='cd ..' # move up 1 dir
alias ...='cd ../..' # move up 2 dirs
alias ....='cd ../../..'
alias server='python -m SimpleHTTPServer 8080' # I want to read my HTML documentation.
#######
# GIT #
#######
alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
what_the_commit () {
echo $(curl --silent http://whatthecommit.com/index.txt)
}
alias wtc='what_the_commit'
alias funnycommit='git commit -a -m "$(wtc)"'
function portforward() {
ssh -L $2:127.0.0.1:$2 $1
}
alias delpyc='find . -name "*.pyc" | xargs rm' # delete all the .pyc files
alias smtp='python -m smtpd -n -c DebuggingServer localhost:1025'
#find . -type f -name '*.txt' -print | while read i
#do
# echo " " > $i
#done
function sl() {
FILENAME=`md5 -qs $1`
MARKDOWNTXT=`html2text $1 --decode-errors=ignore`
echo "saved $FILENAME"
echo -e "[Source]($1)\n\n$MARKDOWNTXT" > ~/Dropbox/webarchive/$FILENAME.md
}
[user]
name = Yashh
email = yashh@some.com
[alias]
st = status -sb
ci = commit
cia = commit --amend
co = checkout
br = branch
sb = show-branch
cp = cherry-pick
staged = diff --cached
rb = rebase
rbc = rebase --continue
rbs = rebase --skip
rl = reflog
rs = remote show
up = !git fetch origin && git rebase origin/master
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
[push]
default = current
[core]
quotepath = false
editor = vim
[difftool "Kaleidoscope"]
cmd = ksdiff-wrapper git \"$LOCAL\" \"$REMOTE\"
prompt = false
[diff]
tool = Kaleidoscope
[rerere]
enabled = 1
[reviewboard]
url = https://something.com/
{
"folder_exclude_patterns":
[
"node_modules",
".cache"
],
"font-face": "Helvetica-Neue",
"font_size": 14,
"ignored_packages":
[
"Vintage"
],
"tab_size": 4,
"translate_tabs_to_spaces": true,
// For the editor
"font_options": [ "gray_antialias" ],
// For the sidebar / other elements
"theme_font_options": [ "gray_antialias" ],
}
shell -bash
nethack on
vbell on
defutf8 on
defscrollback 4096
backtick 1 1 1 date -u +%Y-%m-%dT%TZ
logtstamp on
logtstamp after 250
logtstamp string "%1`"
logfile "screenlog.%t.%1`"
caption always "%{+b kG} %=%{-s} %{.K}%-w%{.B}%n %{.G}%t%{.K}%+w%{.G} %{+s} %="
# |C | |L | |I ||R |
# # #
# # # |C| makes things bold and sets the colors -- black (k) and green (G)
# # #
# # # |I| lists all windows, with the current window a different color
# # # a big mess, which has to be all run together to get the spacing right
# # # %-w all windows up to the current window
# # # %+w all windows following the current window
# # # %n number of the current window
# # # %t command in the current window
# # # %{.K} foreground to gray, background unchanged
# # # %{.B} foreground to gray, background unchanged
# # # %{.G} foreground to green, background unchanged
# # #
# # # |L| blocks in the left margin
# # # note the initial space, to make sure the colors take
# # # with |R| serves to center the text
# # # %= fill
# # # %{-s} turn off reverse video
# # #
# # # |R| blocks in the right margin
# # # note the space, to make sure the style change takes
# # # with |L| serves to center the text
# # # %{+s} turn standout style back on
# # # %= fill
# # #
# #
# termcapinfo xterm ‘bc@:bs@’
#
syntax on "this is needed to see syntax
set background=dark "makes it easier to read with black background
set expandtab "Make tabs into spaces"
set tabstop=4 "Make tabs appear 4 spaces wide (default 8)
set shiftwidth=4
set hidden
colorscheme molokai "set theme in ./vim/colors folder
set ls=2 " allways show status line
set hlsearch " highlight searches
set incsearch " do incremental searching
set ruler " show the cursor position all the time
set visualbell t_vb= " turn off error beep/flash
set ignorecase "ignore case while searching
set number "put numbers on side
set wildmode=longest,list " Get bash style tab completion for file names
filetype on " enables filetype detection
filetype plugin on " enables filetype specific plugins
ab pdb import pdb; pdb.set_trace()
export CLICOLOR=YES
setopt prompt_subst
PS1='%1d%F{blue}$(git_prompt) %F{244}%$ %F{reset}'
git_prompt() {
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/')
if [ ! -z $BRANCH ]; then
echo -n "%F{yellow}$BRANCH"
if [ ! -z "$(git status --short)" ]; then
echo " %F{red}✗"
fi
fi
}
HISTFILESIZE=1000000
HISTSIZE=1000000
HISTCONTROL=ignoreboth
HISTIGNORE='ls:bg:fg:history'
HISTTIMEFORMAT='%F %T '
PROMPT_COMMAND='history -a'%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment