1
0
Fork 0

Add some useful functions

This commit is contained in:
Daniele Tricoli 2020-05-01 00:27:08 +02:00
parent cecf6d5dee
commit 80f4385fc3
3 changed files with 47 additions and 0 deletions

View File

@ -17,6 +17,7 @@ install-zsh:
ln -s `pwd`/zsh/zsh_plugins.txt ~/.zsh_plugins.txt
ln -s `pwd`/zsh/aliases.zsh ~/.aliases.zsh
ln -s `pwd`/zsh/variables.zsh ~/.variables.zsh
ln -s `pwd`/zsh/functions.zsh ~/.functions.zsh
install-mbsync:
rm -f ~/.mbsyncrc

45
zsh/functions.zsh Normal file
View File

@ -0,0 +1,45 @@
cdgopath ()
{
cd $GOPATH
}
# Connect to ssh without recording host-key
sshtmp ()
{
ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" "$@"
}
# Do an SCP without recording, or prompting for host keys.
scptmp ()
{
scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" "$@"
}
# Recursively delete python related unwanted files
nukepy ()
{
find . -regextype posix-egrep -regex '.*\.pyc|.*\.pyo|.*~' -delete;
}
# Recursively delete latex related unwanted files
nuketex ()
{
find . -regextype posix-egrep -regex '.*\.aux|.*\.log|.*\.idx|.*\.toc|.*\.thm|.*\.bbl|.*\.blg|.*\.out|.*\.lol|.*\.lot|.*\.lof|.*~' -delete;
}
# Check running process
pp ()
{
ps aux | awk '!/awk/ && $0~var' var=${1:-".*"} ;
}
# For pypath
pypath ()
{
output=$(pypath.py $*);
if [ $1 = 'show' ]; then
echo $output;
else
eval $output;
fi
}

View File

@ -34,6 +34,7 @@ fi
[[ -f ~/.variables.zsh ]] && source ~/.variables.zsh
[[ -f ~/.aliases.zsh ]] && source ~/.aliases.zsh
[[ -f ~/.functions.zsh ]] && source ~/.functions.zsh
unsetopt share_history