Skip to content

Instantly share code, notes, and snippets.

@vejuhust
Created February 13, 2015 12:54
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 vejuhust/04ba504b514f308dac44 to your computer and use it in GitHub Desktop.
Save vejuhust/04ba504b514f308dac44 to your computer and use it in GitHub Desktop.
# Also write this to .bashrc if it doesn’t contain if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
function gp() {
if [ $# -eq 0 ];
then
count=10
else
count=$1
fi
cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 16 | head -n $count
}
extract() {
if [ -f $1 ];
then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
function mcd() {
mkdir -p "$1" && cd "$1";
}
ft() {
find . -name "$2" -exec grep -il "$1" {} \;
}
alias .='cd ..'
alias ..='cd ../../'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../../'
alias json="python -mjson.tool"
alias upgrade='sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment