File: bashrc

package info (click to toggle)
mysqltuner 2.8.29-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,128 kB
  • sloc: perl: 7,229; sh: 620; python: 135; makefile: 119
file content (115 lines) | stat: -rw-r--r-- 3,028 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# 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"
}