MySQLTuner-perl/build/bashrc
Jean-Marie Renouard 6090b0fa9c Bad merge roolback
2021-10-22 14:50:09 +02:00

116 lines
3.0 KiB
Bash

# Some Alias
alias h=history
alias s=sudo
alias rsh='ssh -l root'
alias lh='ls -lsh'
alias ll='ls -ls'
alias la='ls -lsa'
alias gst='git status'
alias grm='git rm -f'
alias gadd='git add'
alias gcm='git commit -m'
alias gps='git push'
alias gpl='git pull'
alias glg='git log'
alias gmh='git log --follow -p --'
alias gbl='git blame'
alias grs='git reset --soft HEAD~1'
alias grh='git reset --hard HEAD~1'
alias serve="python -m $(python -c 'import sys; print("http.server" if sys.version_info[:2] > (2,7) else "SimpleHTTPServer")')"
gunt() {
git status | \
grep -vE '(Changes to be committed:| to publish your local commits|git add|git restore|On branch|Your branch|Untracked files|nclude in what will b|but untracked files present|no changes added to commit|modified:|deleted:|Changes not staged for commit)' |\
sort | uniq | \
xargs -n 1 $*
}
alias gam='git status | grep "modified" | cut -d: -f2 | xargs -n 1 git add'
gad() {
git status | \
grep 'deleted:' | \
cut -d: -f2- | \
sort | uniq | \
xargs -n 1 git rm -f
}
dcmd()
{
docker exec -i -t $1 bash
}
gen_mysqlalias()
{
input="$1"
while IFS='' read -r line
do
[ -z "$line" ] && continue
container_port=$(echo "$line" | cut -d\; -f1)
container_name=$(echo "$line" | cut -d\; -f2)
container_datadir=$(echo "$line" | cut -d\; -f3)
image_name=$(echo "$line" | cut -d\; -f4)
alias mysql_$container_name="mysql -u root -h 127.0.0.1 -P $container_port"
done < "$input"
}
exec_mysql()
{
input="$1"
name=$2
db=$3
sqlfile=$4
while IFS='' read -r line
do
[ -z "$line" ] && continue
echo "$line" | grep -q $name
[ $? -ne 0 ] && continue
container_port=$(echo "$line" | cut -d\; -f1)
container_name=$(echo "$line" | cut -d\; -f2)
container_datadir=$(echo "$line" | cut -d\; -f3)
image_name=$(echo "$line" | cut -d\; -f4)
echo "* Executing $sqlfile on $container_name"
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
done < "$input"
}
exec_mysqls()
{
input="$1"
db=$2
sqlfile=$3
while IFS='' read -r line
do
[ -z "$line" ] && continue
container_port=$(echo "$line" | cut -d\; -f1)
container_name=$(echo "$line" | cut -d\; -f2)
container_datadir=$(echo "$line" | cut -d\; -f3)
image_name=$(echo "$line" | cut -d\; -f4)
echo "* Executing $sqlfile on $container_name"
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
done < "$input"
}
gen_mysqlalias()
{
input="$1"
while IFS='' read -r line
do
[ -z "$line" ] && continue
container_port=$(echo "$line" | cut -d\; -f1)
container_name=$(echo "$line" | cut -d\; -f2)
container_datadir=$(echo "$line" | cut -d\; -f3)
image_name=$(echo "$line" | cut -d\; -f4)
alias mysql_$container_name="mysql -u root -h 127.0.0.1 -P $container_port"
done < "$input"
}