My config & .dotfiles managed by dotman 🖖
I am pretty new to this stuff(not anymore), so you won't find any scripts that hack NASA. Anyways hope you find something useful, Good luck 👍
.bash_functions
Function Name | Description & Demo |
---|---|
netu 🌐 |
Analyze network data usage |
Demo![]() |
|
vcd 🐍 |
Automatically activate python virtual environments on cd |
scd 💡 |
[s]mart cd searches absolute path names of directories inside your system and switches to them automatically. No need to remember any locations !!. Read More Also see scd-completions.bash for automatic tab suggestions. |
Demo![]() |
|
alarm ⏰ |
A single line utility for a timer/alarm |
myip 🌐 |
A single line utility for showing my IP address |
extract 📦 |
A utility for extracting different archives in an easy way |
scripts
A realtime update of your system using common shell commands
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/sys && chmod +x sys && mv sys $HOME/.local/bin/
A utility to watch a Markdown file & build its HTML preview using commonmarker
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/md && chmod +x md && mv md $HOME/.local/bin/
A utility to check color capability of your terminal
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/colors && chmod +x colors && mv colors $HOME/.local/bin/
A python utility to list a github user's pull requests in a nicely readable markdown file with 0 external dependencies.
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/myprs && chmod +x myprs && mv myprs $HOME/.local/bin/
A python utility to backup files on Github as a Secret Gist (0 dependency)
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/bkp && chmod +x bkp && mv bkp $HOME/.local/bin/
A python utility to list all the contributors on your github repositories
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/contributors && chmod +x contributors && mv contributors $HOME/.local/bin/
A shell utility to convert videos to high-quality GIFs using ffmpeg
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/gif && chmod +x gif && mv gif $HOME/.local/bin/
A python script to surf the web from command line, powered by searx (0 external dependencies)
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/surf && chmod +x surf && mv surf $HOME/.local/bin/
A utility to open a text-file as a HTML page so that I can use grammarly web extension
-_-
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/oib && chmod +x oib && mv oib $HOME/.local/bin/
A python utility to generate a feed of recently committed files inside a git repository
Install
wget -q https://raw.githubusercontent.com/Bhupesh-V/.Varshney/master/scripts/git-feed && chmod +x git-feed && mv git-feed $HOME/.local/bin/
.bash_aliases
Some handy aliases under different categories.
Git
# Add your staged changes to the previous commit
# while preserving your commit message
alias giac='git commit --amend -C HEAD'
alias gic='git commit'
alias gicl='git clone'
alias gil='git log --graph --decorate --pretty=oneline --abbrev-commit'
alias gim='git merge'
alias gid='git diff'
# undo last commit (unstage everything)
alias giu='git reset HEAD~'
# undo last commit (don't unstage everything)
alias gius='git reset --soft HEAD^'
Go
alias gb="go build"
alias gr="go run"
alias gd="go doc -all"
alias gg="go get"
alias gt="go test"
Miscellaneous
# create python virtualenv
alias venv="python3 -m venv"
# watch realtime system info
alias sys="watch -ct -n0 $HOME/Documents/.Varshney/scripts/sys.sh"
# python http server
alias serve="python3 -m http.server"
# grep pattern inside files
alias lk="grep -nir --exclude-dir=.git"
# search history for commands
alias hg="history | grep"
.bashrc
My PS1
is highly customized.
Here is how its done
# Gib me all the colors
export TERM=xterm-256color
# disable the default virtualenv prompt change
export VIRTUAL_ENV_DISABLE_PROMPT=1
# color definitions
RESET="\e[0m"
BOLD_BLACK_FG="\e[1;30m"
ORANGE_FG="\e[38;5;214m"
ORANGE_BG="\e[48;5;214m"
GRAY_BG="\e[48;5;234m"
GRAY_FG="\e[38;5;234m"
BOLD_L_YELLOW=$'\e[1;38;5;11m'
BOLD_RED_FG=$'\e[1;38;5;9m'
BOLD_GREEN_FG=$'\e[1;32m'
random_emoji() {
# add a random emoticon (mostly face emojis)
printf "%b" "\U1F$(shuf -i600-640 -n1)"
}
get_git_branch() {
curr_branch=$(git branch 2> /dev/null | awk '/*/ {print $2}')
[ "$curr_branch" ] && printf "%s" "($(tput bold)$(tput setaf 208)$curr_branch$(tput sgr0))"
}
pc_uptime() {
uptime -p | awk '{for (i=2; i<NF; i++) printf $i " "; if (NF >= 1) print $NF; }'
}
virtualenv_ps1() {
[ "$VIRTUAL_ENV" ] && printf "%s" " $(basename "$VIRTUAL_ENV")"
}
rightprompt() {
# display stuff on right side of prompt
printf '%*s' $COLUMNS "$(pc_uptime)"
}
# handles cursor position
RIGHT_PROMPT="\n\$(tput sc; rightprompt; tput rc)"
custom_prompt() {
EXIT="$?"
last_command_status=$([ "$EXIT" != 0 ] && printf "%s" "\[$BOLD_RED_FG\]✘")
arrp="\[$GRAY_BG\] $last_command_status $(random_emoji) \[$GRAY_FG\]\[$ORANGE_BG\]\[$ORANGE_BG\]\[$BOLD_BLACK_FG\] $(virtualenv_ps1) \[$RESET\]\[$ORANGE_FG\]\[$RESET\]"
PS1="\[$BOLD_L_YELLOW\]\[$RIGHT_PROMPT\]\[$RESET\]\[$BOLD_GREEN_FG\]\w\[$RESET\] $(get_git_branch)\n$arrp "
}
if [ "$color_prompt" = yes ]; then
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PROMPT_COMMAND=custom_prompt
else
PS1='${debian_chroot:+($debian_chroot)}\[email protected]\h:\w\$ '
fi
unset color_prompt force_color_prompt
init.vim
or .vimrc
Current colorscheme: palenight
Learn more about vim in my my-vim-cheatsheet
Shortcut | Purpose |
---|---|
F3 |
Open :term |
F4 |
Insert Current Date (dd mm, yyyy) |
F5 |
Source $MYVIMRC |
F6 |
:NERDToggle |
F7 |
Edit $MYVIMRC |
F8 |
Switch to Transparent Mode |
F9 |
Write and Quit on all buffers (Kill Switch) |
F10 |
Indent based on FileType |
Alt + m
|
Build & Run code using :make |
Alt + h
|
Vertical resize +3 |
Alt + l
|
Vertical resize -3 |
Alt + k
|
Horizontal resize +3 |
Alt + j
|
Horizontal resize +3 |
Alt + <CR>
|
Switch to :Goyo Mode |
Shift + k
|
Move line(s) up |
Shift + j
|
Move line(s) down |
Shift + r
|
Run linux Command at current line |
Shift + l
|
Open hyperlink at current line |
Shift + t
|
Switch buffer in current window |
Ctrl + c
|
Copy in Visual Mode |
Ctrl + v
|
Paste in Insert Mode |
t |
Toggle Comment in Current line (Normal Mode) |
<space> |
Toggle Fold at Current line |
<Tab> |
Switch Windows |
Plugins:
:w
)Some of my fav colorschemes:
Support me by giving a ⭐️ if this project helped you! or just
Copyright © 2020 Bhupesh Varshney.
This project is GPLv3 licensed.