Skip to content

Instantly share code, notes, and snippets.

@tomashejatko
Created May 10, 2012 23:40
Show Gist options
  • Save tomashejatko/2656604 to your computer and use it in GitHub Desktop.
Save tomashejatko/2656604 to your computer and use it in GitHub Desktop.
.bashrc arteal
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# PS1 COLORS
if [ "$UID" != "0" ]; then
UID_COLOR='\[\e[0;32m\]'
UID_BG='\[\e[42m\]'
UID_CHAR='$'
else
UID_COLOR='\[\e[0;31m\]'
UID_BG='\[\e[41m\]'
UID_CHAR='#'
fi
# If I am in screen, I want to know 'bout it
#if [ "$TERM" == "screen" ]; then
# PROMPT_COMMAND="echo -n [S]"
#fi
# (not so) Shiny PS1
PS1="${UID_BG}${UID_COLOR}[\u@\h \W]${UID_CHAR}\[\e[0m\] "
PATH=$PATH:/home/arteal/bin
# some timesaving stuff
alias ls='ls -F --color=auto'
alias lss='ls -ls'
alias lsA='ls -lsA'
alias xp='xprop | grep "WM_WINDOW_ROLE\|WM_CLASS" && echo "WM_CLASS(STRING) = \"NAME\", \"CLASS\""'
alias root='sudo -E bash -l'
alias pingoogle='ping www.google.com'
# history file 3k lines long
export HISTFILESIZE=3000
# Avoid succesive duplicates in the bash command history.
export HISTCONTROL=ignoredups
#I love vim editor
export EDITOR=vim
#non-X machines
export XDG_CONFIG_HOME=/home/arteal/.config
# tweak firefox somehow
export MOZ_DISABLE_PANGO=1
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Append commands to the bash command history file (~/.bash_history)
# instead of overwriting it.
shopt -s histappend
# Have to work with links(not ment as /usr/bin/links, but as <a> tag), but not yet completed
if [ -n "$DISPLAY" ]; then
export BROWSER=firefox
else
export BROWSER=links
fi
# Other timesaving stuff
settitle() {
printf "\033k$1\033\\"
}
ssh() {
#settitle "$*"
command ssh "$@"
}
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
# Some funny stuff from cows
fortune -a | fmt -80 -s | cowsay -$(shuf -n 1 -e b d g p s t w y) -f $(shuf -n 1 -e $(cowsay -l | tail -n +2)) -n
#eval `keychain --eval --agents ssh id_rsa`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment