summaryrefslogtreecommitdiff
path: root/.bashrc_local_home
blob: 288176bec0c0f87558c1966cb7cc2bdc70e547db (plain)
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
function mutt_docker
{
    docker run -ti \
        -e TERM_BG_SHADE=$TERM_BG_SHADE \
        -e TERM=$TERM \
        -v $HOME/contacts.txt:/home/mutt/contacts.txt:ro \
        -v $HOME/.vim:/home/mutt/.vim:ro \
        -v $HOME/.mutt/:/home/mutt/.mutt:ro \
        -v $HOME/Mail:/home/mutt/Mail:ro \
        -v $HOME/share:/home/mutt/share \
        docker.crute.me/mutt:latest
}
export -f mutt

function alpine-build
{
    local image_name="alpine:edge"
    local update_file="$HOME/.cache/alpine-build-pull"

    # Pull image if no image update timestamp file
    if [ ! -f "$update_file" ]; then
        touch "$update_file"
        docker pull "$image_name"
    fi

    # Pull image if we haven't pulled it in at least 3 days
    if [ $(( $(date +%s) - $(stat -c "%Y" "$update_file") )) -gt 259200 ]; then
        touch "$update_file"
        docker pull "$image_name"
    fi

    docker run -ti --rm --detach-keys=ctrl-@ \
        --privileged \
        -e ALPINE_UID=$UID \
        -v $HOME/bin:/opt/home-bin:ro \
        -v $HOME/.abuild:/abuild-keys:ro \
        -v $HOME/repos/alpine/aports:/aports \
        -v $HOME/.gitconfig:/opt/.gitconfig \
        -v $HOME/.gitconfig-personal:/opt/.gitconfig-personal \
        "$image_name" /opt/home-bin/aport-bootstrap.sh
}
export -f alpine-build

function alpine-website
{
    local image_name="alpine:edge"
    local update_file="$HOME/.cache/alpine-build-pull"

    # Pull image if no image update timestamp file
    if [ ! -f "$update_file" ]; then
        touch "$update_file"
        docker pull "$image_name"
    fi

    # Pull image if we haven't pulled it in at least 3 days
    if [ $(( $(date +%s) - $(stat -c "%Y" "$update_file") )) -gt 259200 ]; then
        touch "$update_file"
        docker pull "$image_name"
    fi

    docker run -ti --rm --detach-keys=ctrl-@ \
        --privileged \
		-p 8080:8080 \
        -v $HOME/bin:/opt/home-bin:ro \
        -v $HOME/.abuild:/abuild-keys:ro \
        -v $HOME/repos/third_party/aports:/aports \
        -v $HOME/.gitconfig:/opt/.gitconfig \
        -v $HOME/.gitconfig-personal:/opt/.gitconfig-personal \
		-v $HOME/repos/third_party/alpine-mksite:$HOME/alpine-mksite \
        "$image_name" /opt/home-bin/aport-bootstrap.sh
}
export -f alpine-website

export TERM_BG_SHADE="dark"

alias vssh="ssh -t mcrute-virt.sea1.crute.me \"bash -c 'tm mike'\""
alias mfi-ssh="ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -l admin "

simple-info() {
    for i in /usr/share/info/*; do
        m="$(basename "$i")"
        n="${m%.info.gz}"
        echo ${n%.gz}
    done | less -FSRX

    # There can be many .info-\d+.gz
    zcat "/usr/share/info/$1.info.gz" |
        sed -Ee "/\x1f/d; /^File: $1.info,/d; /^(Node|Ref): .*�/d" |
        cat -s |
        less
}

get_ssh_agent