Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sreerajkksd committed Sep 10, 2020
0 parents commit fd06445
Show file tree
Hide file tree
Showing 18 changed files with 674 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.vscode

47 changes: 47 additions & 0 deletions Readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
========
Dotfiles
========

This is my collection of `configuration files <http://dotfiles.github.io/>`_.

Configurations are managed by `dotstow <https://github.com/codejamninja/dotstow>`_


To install:

- Install dotstow

.. code-block:: bash
npm install -g dotstow
- Download your dotfiles

.. code-block:: bash
dotstow sync GITHUB_REPO_LINK
- Manual init

.. code-block:: bash
~/.dotfiles/manual-init.sh
- Set the configs

.. code-block:: bash
dotstow stow bash git i3 system tmux vim vscode zsh
- To update the configs

- Upload changes the repository in github.
- Run `dotstow sync`


=======
Credits
=======

- Sreeraj Karichery ([email protected])
62 changes: 62 additions & 0 deletions linux/bash/.aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#Directory navigation aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
#!/usr/bin/env bash

# ls aliases
alias ls='ls --color=auto' # add colors for filetype recognition
alias lx='ls -lXB' # sort by extension
alias lk='ls -lSr' # sort by size
alias la='ls -Al' # show hidden files
alias lr='ls -lR' # recursice ls
alias ll='ls -l --color=auto --time-style="+%Y-%m-%d %H:%M:%S"' # long listing
alias l.='ls -d .* --color=auto'
alias l='ls -hF --color' # quick listing
alias lsd='ls -l | grep "^d"' #list only directory

alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias tailf='tail -f'

alias c='clear'
alias user="getent passwd"
alias group="getent group"
alias df='df -Th'

alias ps='ps f'
alias psgr='ps aux | grep -v grep | grep -i -e VSZ -e'
alias pstree='pstree -haspg '

# Generic Miscellaneous
alias mkdate='mkdir `date +%Y-%m-%d`'
alias finduser='getent passwd | grep -i '
alias list-dep='systemctl list-dependencies'
alias source-all='source ~/.bashrc ~/.bash_functions'
alias drop-caches='sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"'
alias strip="sed 's/^[ \t]*//;s/[ \t]*$//'"

# Git related
alias git-graph='git log --graph --oneline --all'
alias git-character-diff='git diff --word-diff-regex=.'
alias git-show-diff='git show --word-diff-regex=.'
alias git-log-pretty='git log --pretty=format:"%h%x09%an%x09%ad%x09%s"'
alias git-commit-ammend='git commit --amend'
alias git-commit-ammend-no-edit='git commit --amend --no-edit'

# Editor related
# Use vim if present for vi
alias view='vi -R '
if [ -x "$(command -v vim)" ]; then
alias vi='vim'
alias view='vim -R'
fi
alias em='emacs -nw'

alias trs='tmux rename-session '
alias hr='history -r'

# Reload the shell (i.e. invoke as a login shell)
alias reload="exec ${SHELL} -l"
48 changes: 48 additions & 0 deletions linux/bash/.bash_functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

# Update the repository
function up {
if ! cvs status 2>&1 | grep -q "No CVSROOT specified"; then
cvs update -ACPdR
elif ! svn -v status 2>&1 | grep -q "is not a working copy"; then
svn update
elif ! git status 2>&1 | grep -q "Not a git repository"; then
git pull --rebase
else
echo "Not a git/svn/cvs working directory"
fi
}


#open script
function vi-which { vim $(which $1); }
function which-vi { vim $(which $1); }

function atop-now() {
today=$(date "+%Y%m%d");
now=$(date "+%H:%M")
echo "atop -r /var/log/atop/atop_$today -b $now ${@:2}"
eval 'atop -r /var/log/atop/atop_$today -b $now "${@:2}"'
}

function ssh-diff() {

source_file=$1
host=$2
if [[ $# -eq 3 ]]; then
destination_file=$3
else
destination_file=$1
fi

eval 'diff $source_file <(ssh $host cat $destination_file)'
}

function tailfs() {
tail_cmd=""
for file in "$@"
do
tail_cmd+="tail -f $file && "
done
eval "${tail_cmd::-3}";
}
76 changes: 76 additions & 0 deletions linux/bash/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# .bashrc
#
# This file is read by bash every time a shell starts. Only put bash
# specific things (aliases, unexported variables) here. Exported
# environment variables should be in .envrc, and path changes in .pathrc.

# Do not take the following lines out unless you're really sure of
# what you are doing.

function check_and_source {
if [ -r $1 ]; then source $1; fi
}

check_and_source ~/.bash_functions

# If not running interactively, don't do anything from now onwards.
[ -z "$PS1" ] && return

check_and_source ~/bash_completion.d/_auto_completions.bash


who=`whoami`

if [ "${who}" == "${LOGNAME}" ]; then
UA=""
COLOR="38;5;141m"
else
UA="$who@"
COLOR="38;5;155m"
fi

PS1='\[\e[$COLOR\][$?][\D{%T }${UA}$HOST \w]> \[\e[m\]'
export PROMPT_DIRTRIM=2

# Set default visual editor
export VISUAL=vi
if [ -x "$(command -v vim)" ]; then
export VISUAL=vim;
fi

#shell Options
shopt -s autocd cdspell expand_aliases no_empty_cmd_completion cmdhist nocaseglob dirspell checkwinsize

# History config
export HISTFILE=${HOME}/.eternal_history
export HISTTIMEFORMAT='%F %T '
export HISTCONTROL=ignoredups:erasedups:ignorespace
export HISTSIZE=100000
export HISTFILESIZE=100000
# Force prompt to write history after every command.
# http://superuser.com/questions/20900/bash-history-loss
PROMPT_COMMAND="history -a;"

# Python3 installation
export PYTHONNOCLEANSYSPATH="yes"


bind 'set bell-style none'

# export SSH_AUTH_SOCK=/tmp/karicher-ssh-agent.$HOSTNAME.sock


[ -f ~/.fzf.bash ] && source ~/.fzf.bash

## Control + F to search files
# https://github.com/junegunn/fzf/issues/546
bind -x '"\C-f": fzf-file-widget'
bind '"\C-t": transpose-chars'

fasd_cache="$HOME/.fasd-init-bash"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
$HOME/bin/fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install >| "$fasd_cache"
fi

source "$fasd_cache"
unset fasd_cache
25 changes: 25 additions & 0 deletions linux/bash/.inputrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# Make Tab autocomplete regardless of filename case
set completion-ignore-case on

# Use the text that has already been typed as the prefix for searching through
# commands (i.e. more intelligent Up/Down behavior)
"\e[A": history-search-backward
"\e[B": history-search-forward


# Do not autocomplete hidden files unless the pattern explicitly begins with a dot
set match-hidden-files off

# Show all autocomplete results at once
set page-completions off

# If there are more than 200 possible completions for a word, ask to show them all
set completion-query-items 200

# Be more intelligent when autocompleting by also looking at the text after
# the cursor. For example, when the current line is "cd ~/src/mozil", and
# the cursor is on the "z", pressing Tab will not autocomplete it to "cd
# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the
# Readline used by Bash 4.)
set skip-completed-text on
4 changes: 4 additions & 0 deletions linux/bash/bash_completion.d/_auto_completions.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/usr/bin/env bash

complete -A user user
complete -A user finduser
33 changes: 33 additions & 0 deletions linux/git/.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[user]
name = Sreeraj.Karichery
email = [email protected]

[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits.
l = log --pretty=oneline -n 20 --graph --abbrev-commit

# List contributors with number of commits.
contributors = shortlog --summary --numbered

# Show the user email for the current repository.
whoami = config user.email

[branch]
# Show most recently changed branches first.
sort = -committerdate

[core]
pager = less -r

[diff]
# Detect copies as well as renames.
renames = copies

[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process

[help]
autoCorrect = 1
7 changes: 7 additions & 0 deletions linux/git/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
!tags/
*.pyc
*.sw[nop]
.bundle
.env
.git/
node_modules/
Loading

0 comments on commit fd06445

Please sign in to comment.