summaryrefslogtreecommitdiff
path: root/dotfiles/profile
blob: 17b169eb82f77a16962febc1af59db0c3462a74a (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
# environment

## prevent python from crapping all over the filesystem
export PYTHONDONTWRITEBYTECODE=1

## put XDG_RUNTIME_DIR crap under .cache
## not the optimal solution, but should be
## good enough in practice
## TODO: maybe look into setting up something ## better, perhaps with pam
## auto-creating and cleaning a per-boot dir
export XDG_RUNTIME_DIR=${HOME}/.cache/

# colors for less
export LESS="-iR"
export LESS_TERMCAP_mb=$'\E[01;36m'
export LESS_TERMCAP_md=$'\E[01;36m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[11;32m'

## set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

# ups.khirnov.net uploader
ups() {
    if [ "$1" ]; then
        fname=$(basename "$1")
    else
        fname="-"
    fi

    url=$(curl -sS -E ~/.local/var/up/cert --data-binary "@${fname}" "https://ups.khirnov.net/${fname}")
    [ "${url}" ] && echo "${url}"
}

# up.khirnov.net 0x0 instance
up() {
    if [ "$1" ]; then
        fname=$(basename "$1")
    else
        fname="-"
    fi

    url=$(curl -sS -E ~/.local/var/up/cert -F "file=@${fname}" "https://up.khirnov.net/")
    [ "${url}" ] && echo "${url}"
}

# TODO: umask?

# source the machine-local configuration
[ -r "$HOME/.config/profile_local.sh" ] && . "$HOME/.config/profile_local.sh"

# when running bash, include .bashrc if it exists
if [ -n "$BASH_VERSION" -a -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
fi