move files to directories for stow
This commit is contained in:
70
bash/.bash_aliases
Normal file
70
bash/.bash_aliases
Normal file
@@ -0,0 +1,70 @@
|
||||
alias ll='ls -lhF'
|
||||
alias la='ls -AF'
|
||||
alias l='ls -CF'
|
||||
alias lla='ls -alF'
|
||||
alias scp='scp -C'
|
||||
alias ssh='ssh -C'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
alias rm='rm -i'
|
||||
alias df='df -h'
|
||||
case "$(uname -s)" in
|
||||
FreeBSD)
|
||||
alias ls='ls -GF'
|
||||
alias t='todo -d ~/.todo.cfg'
|
||||
alias grep='grep --color=auto'
|
||||
;;
|
||||
Linux)
|
||||
alias ls='ls --color=auto -vF'
|
||||
alias t='~/sources/todo.txt-cli/todo.sh -d ~/.todo.cfg'
|
||||
alias grep='grep --color=auto'
|
||||
;;
|
||||
OpenBSD)
|
||||
alias startx="/usr/X11R6/bin/startx & lock -np"
|
||||
;;
|
||||
esac
|
||||
alias less='less -X'
|
||||
alias youtube='youtube-dl -o "$YDL_TARGET/%(title)s.%(ext)s" --restrict-filenames --prefer-free-formats '
|
||||
alias sudo='sudo '
|
||||
alias ga='git-annex '
|
||||
alias gas='git-annex sync '
|
||||
alias vi='vim '
|
||||
alias tmr='~/bin/tmux_rattach.sh'
|
||||
alias mpc='mpc -f "[%artist% - %title% \[%album%\] %date%]|[%file%]"'
|
||||
# envoie la playlist mpc et lit le meme morceau
|
||||
function mpct() {
|
||||
if [ $1 ] ; then
|
||||
mpc -h $1 clear
|
||||
mpc -f %file% playlist | mpc -h $1 -q add
|
||||
mpc -h $1 play `mpc -f %position% -q current`
|
||||
fi
|
||||
}
|
||||
# recoit la playlist mpc et lit le meme morceau
|
||||
function mpcf() {
|
||||
if [ $1 ] ; then
|
||||
mpc clear
|
||||
mpc -h $1 -f %file% playlist | mpc -q add
|
||||
mpc play `mpc -h $1 -f %position% -q current`
|
||||
fi
|
||||
}
|
||||
# genere un password aleatoire
|
||||
randpw(){
|
||||
strings /dev/urandom | grep -o '[[:graph:]]' | head -n 20 | tr -d '\n'
|
||||
echo
|
||||
}
|
||||
# git status dans tous les sous-repertoires de sources
|
||||
alias srcstatus='show_status -d ~/sources/'
|
||||
|
||||
alias reboot='sudo reboot'
|
||||
alias poweroff='sudo poweroff'
|
||||
alias vm='sudo vm'
|
||||
|
||||
alias myip="host -4 myip.opendns.com resolver1.opendns.com | sed -n 's/myip\.opendns\.com has address \(.*\)$/\1/p'"
|
||||
|
||||
alias ip='ip --color'
|
||||
alias ipb='ip --color --brief'
|
||||
|
||||
alias dc='docker-compose'
|
||||
|
||||
# IP docker container
|
||||
alias d_ip="docker inspect -f '{{ .NetworkSettings.IPAddress }}' "
|
||||
7
bash/.bash_logout
Normal file
7
bash/.bash_logout
Normal file
@@ -0,0 +1,7 @@
|
||||
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
||||
|
||||
# when leaving the console clear the screen to increase privacy
|
||||
|
||||
if [ "$SHLVL" = 1 ]; then
|
||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||
fi
|
||||
174
bash/.bashrc
Normal file
174
bash/.bashrc
Normal file
@@ -0,0 +1,174 @@
|
||||
# If not running interactively, don't do anything
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
##### VARIABLES #####
|
||||
# don't put duplicate lines in the history. See bash(1) for more options
|
||||
export HISTCONTROL=ignoredups
|
||||
# ... and ignore same sucessive entries.
|
||||
export HISTCONTROL=ignoreboth
|
||||
# size
|
||||
export HISTSIZE=10000
|
||||
export HISTFILESIZE=100000
|
||||
# navigateur prefere
|
||||
export BROWSER=firefox
|
||||
# editeur par defaut
|
||||
export EDITOR=vim
|
||||
export VISUAL=$EDITOR
|
||||
# pager man conserve affichage à l'écran
|
||||
export MANPAGER="less -X"
|
||||
# youtube dl default
|
||||
export YDL_TARGET=$HOME/tmp
|
||||
# kubectl
|
||||
export KUBECONFIG=~/.kube/config
|
||||
|
||||
##### COLORS #####
|
||||
|
||||
# ls colors
|
||||
export LSCOLORS="ExGxFxdxCxDxDxhbadExEx"
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ "$TERM" != "dumb" ]; then
|
||||
[ -x /usr/bin/dircolors ] && eval "`dircolors -b`"
|
||||
fi
|
||||
|
||||
RED='\[\033[0;31m\]'
|
||||
REDB='\[\033[1;31m\]'
|
||||
GREEN='\[\033[0;32m\]'
|
||||
GREENB='\[\033[1;32m\]'
|
||||
YELLOW='\[\033[0;33m\]'
|
||||
YELLOWB='\[\033[1;33m\]'
|
||||
BLUE='\[\033[0;34m\]'
|
||||
BLUEB='\[\033[1;34m\]'
|
||||
PURPLE='\[\033[0;35m\]'
|
||||
PURPLEB='\[\033[1;35m\]'
|
||||
CYAN='\[\033[0;36m\]'
|
||||
CYANB='\[\033[1;36m\]'
|
||||
WHITE='\[\033[0;37m\]'
|
||||
WHITEB='\[\033[1;37m\]'
|
||||
RESET='\[\033[0;00m\]'
|
||||
|
||||
##### INCLUDES #####
|
||||
|
||||
# Alias definitions.
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
# host specific
|
||||
if [ -f ~/.bash_aliases_$(hostname -s) ]; then
|
||||
. ~/.bash_aliases_$(hostname -s)
|
||||
fi
|
||||
if [ -f ~/.bashrc_$(hostname -s) ]; then
|
||||
. ~/.bashrc_$(hostname -s)
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
# FreeBSD
|
||||
[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] && \
|
||||
source /usr/local/share/bash-completion/bash_completion.sh
|
||||
|
||||
##### MISC #####
|
||||
|
||||
# edit file in tmux pane
|
||||
peek() { tmux split-window -p 33 "$EDITOR" "$@" || exit; }
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
# conserve l'historique lorsque l'on utilise plusieurs terminaux
|
||||
shopt -s histappend
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Tmux + ssh agent forwarding
|
||||
if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
|
||||
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
|
||||
fi
|
||||
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
|
||||
|
||||
##### PROMPT #####
|
||||
prompt_status()
|
||||
{
|
||||
# unicode to hex: echo -ne "\u2620" | hexdump -C
|
||||
if [[ "$exitStatus" == "0" ]]
|
||||
then
|
||||
echo -n "${GREENB}\xE2\x9a\x90"
|
||||
else
|
||||
echo -n "${REDB}\xE2\x9a\x91"
|
||||
fi
|
||||
}
|
||||
prompt_root()
|
||||
{
|
||||
if [[ "$(id -u)" == "0" ]]
|
||||
then
|
||||
echo -n "${REDB}#"
|
||||
else
|
||||
echo -n "${WHITEB}$"
|
||||
fi
|
||||
}
|
||||
prompt_remote()
|
||||
{
|
||||
if [[ -n "$SSH_CLIENT" ]]
|
||||
then
|
||||
echo -n "${RED}"
|
||||
else
|
||||
echo -n "${GREEN}"
|
||||
fi
|
||||
}
|
||||
__ps1pre()
|
||||
{
|
||||
export exitStatus=$?
|
||||
echo -en "${YELLOWB}(${WHITE}\u${YELLOWB}@$(prompt_remote)\h${YELLOWB}) ${BLUEB}\w${RESET}"
|
||||
}
|
||||
__ps1post()
|
||||
{
|
||||
echo -en "\n$(prompt_status) $(prompt_root)${RESET} "
|
||||
}
|
||||
__ps1()
|
||||
{
|
||||
exitStatus=$?
|
||||
PS1="$(__ps1pre)$(__ps1post)"
|
||||
}
|
||||
__ps1_git()
|
||||
{
|
||||
exitStatus=$?
|
||||
__git_ps1 "$(__ps1pre)" "$(__ps1post)"
|
||||
}
|
||||
PROMPT_COMMAND='__ps1'
|
||||
|
||||
##### GIT #####
|
||||
|
||||
if [ -e /usr/local/share/git-core/contrib/completion/git-completion.bash ]; then
|
||||
. /usr/local/share/git-core/contrib/completion/git-completion.bash
|
||||
fi
|
||||
if [ -e $HOME/.git-completion.bash ]; then
|
||||
. $HOME/.git-completion.bash
|
||||
fi
|
||||
if [ -e $HOME/bin/git-prompt.sh ] || [ -e /usr/local/share/git-core/contrib/completion/git-prompt.sh ] || [ -e /usr/lib/git-core/git-sh-prompt ]; then
|
||||
if [ -e $HOME/bin/git-prompt.sh ]; then
|
||||
. $HOME/bin/git-prompt.sh
|
||||
fi
|
||||
if [ -e /usr/lib/git-core/git-sh-prompt ]; then
|
||||
. /usr/lib/git-core/git-sh-prompt
|
||||
fi
|
||||
if [ -e /usr/local/share/git-core/contrib/completion/git-prompt.sh ]; then
|
||||
. /usr/local/share/git-core/contrib/completion/git-prompt.sh
|
||||
fi
|
||||
export GIT_PS1_SHOWDIRTYSTATE=1
|
||||
export GIT_PS1_SHOWSTASHSTATE=1
|
||||
export GIT_PS1_SHOWUNTRACKEDFILES=1
|
||||
export GIT_PS1_SHOWUPSTREAM="auto"
|
||||
export GIT_PS1_SHOWCOLORHINTS=1
|
||||
PROMPT_COMMAND='__ps1_git'
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user