Ajoute des fonctions bien cool
This commit is contained in:
parent
63df7e0c26
commit
dec54d6658
@ -18,4 +18,50 @@ xmlpretty() {
|
||||
local FILENAME=${ORIGINAL%.xml}
|
||||
local FINAL=${FILENAME##*/}
|
||||
xmllint --format "$1" --output ${FINAL}.pretty.xml
|
||||
}
|
||||
}
|
||||
|
||||
function extract()
|
||||
{
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xvjf $1 ;;
|
||||
*.tar.gz) tar xvzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xvf $1 ;;
|
||||
*.tbz2) tar xvjf $1 ;;
|
||||
*.tgz) tar xvzf $1 ;;
|
||||
://codepad.canhelpme.com/nabled=true
|
||||
*.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
|
||||
}
|
||||
|
||||
# Creates an archive (*.tar.gz) from given directory.
|
||||
function maketar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
|
||||
|
||||
# Create a ZIP archive of a file or folder.
|
||||
function makezip() { zip -r "${1%%/}.zip" "$1" ; }
|
||||
|
||||
function my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,bsdtime,command ; }
|
||||
function pp() { my_ps f | awk '!/awk/ && $0~var' var=${1:-".*"} ; }
|
||||
|
||||
function dataurl()
|
||||
{
|
||||
local mimeType=$(file -b --mime-type "$1")
|
||||
if [[ $mimeType == text/* ]]; then
|
||||
mimeType="${mimeType};charset=utf-8"
|
||||
fi
|
||||
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')"
|
||||
}
|
||||
|
||||
shopt -s cdspell # autocorrects cd misspellings
|
||||
shopt -s checkwinsize # update the value of LINES and COLUMNS after each command if altered
|
||||
|
||||
date
|
||||
|
Loading…
Reference in New Issue
Block a user