summaryrefslogtreecommitdiff
path: root/.zshrc
blob: 28416d3bb62af767c084871c5e1cc67c57c2fc10 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
export ZSH="/home/fkfd/.oh-my-zsh"

ZSH_THEME="fkfd"

plugins=(
	git
	python
    pj
    urltools
    mosh
)

source $ZSH/oh-my-zsh.sh

export EDITOR=/usr/bin/nvim
export BROWSER=/usr/bin/firefox
export PROJECT_PATHS=(~/Projects/ ~/Projects/_cloned/ ~/Projects/_archive/)
export GOPROXY=https://proxy.golang.com.cn,direct
export PATH="$HOME/.local/bin:$PATH"

# utilities
share () {
    src=$1
    if [[ $2 == '' ]]; then
        dst=$1
    else
        dst=$2
    fi
    scp -r $src www@fkfd.me:www/static/$dst
    echo "https://fkfd.me/static/$(urlencode $(basename $dst))"
}

bright () {
    if [[ $1 == 10 ]]; then
        xrandr --output HDMI-A-0 --brightness 1
        return 0
    fi
    xrandr --output HDMI-A-0 --brightness "0.$1"
}

mnt-cryfs () {
    cryfs "/data/Vaults/$1.enc" "$HOME/Vaults/$1"
}

umnt-cryfs () {
    cryfs-unmount "$HOME/Vaults/$1"
}

# ibus
alias ib="ibus-daemon -d"
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

# SSH
alias mrf="mosh root@fkfd.me"
alias mff="mosh fred@fkfd.me"
alias tilde="mosh fkfd@tilde.town -ssh='ssh -i ~/.ssh/id_rsa'"

# file privileges
alias gimme="sudo chown -R $USER ./ && sudo chmod -R +rw ./*"
alias lemme="sudo chmod +x"

# embedded
alias ard="arduino-cli"

# python
alias py="python"
alias venv="source ./venv/bin/activate"

# tools
alias ytdl="youtube-dl --proxy socks5://localhost:1080/"
alias ytdlp="yt-dlp --proxy socks5://localhost:1080/"
alias v="nvim"
alias c="cat"
alias ls="exa"
alias dormshare="sudo python -m http.server -b 192.168.8.88 80"

alias tlmgr="/usr/share/texmf-dist/scripts/texlive/tlmgr.pl --usermode"

alias catpic="montage -tile 1x -geometry +0+0"

# fun
alias rickroll="vlc -f '/data/Videos/Rick Astley - Never Gonna Give You Up (Official Music Video).mkv'"

# disable beep in x11
set -B 0

# something fucked up
alias je="journalctl -e"
alias what-the-fuck-just-happened="journalctl -e -b -1"
alias accel="killall kglobalaccel5 && kglobalaccel5&"

# VG151
alias gccf="gcc -O2 -Werror -Wpedantic -Wall -Wextra -Wconversion -Wvla -std=c11"
gccc () {
    if [[ $1 == '-j' ]]; then
        gccf -o $2.out $2.c -D JOJ
    elif [[ $1 == '-d' ]]; then
        gccf -o $2.out $2.c -D DEBUG
    else
        gccf -o $1.out $1.c
    fi
}

alias g++f="g++ -Wall -Wextra -pedantic -Wvla -Werror -Wsign-conversion -std=c++17"
g+++ () {
    if [[ $1 == '-j' ]]; then
        g++f -o ex$2.out ex$2.cpp -D JOJ
    elif [[ $1 == '-d' ]]; then
        g++f -o ex$2.out ex$2.cpp -D DEBUG
    else
        g++f -o ex$1.out ex$1.cpp
    fi
}

extar () {
    tar cf ex$1.tar ex$1.cpp homework.h
}

# auto-generated by kdesrc-build initial setup: do not remove!
# Add the kdesrc-build directory to the path
# export PATH="$HOME/kde/src/kdesrc-build:$PATH"
# Create alias for running software built with kdesrc-build
kdesrc-run ()
{
  source "$HOME/kde/build/$1/prefix.sh" && "$HOME/kde/usr/bin/$1"
}


# kdesrc-build #################################################################

## Add kdesrc-build to PATH
export PATH="$HOME/kde/src/kdesrc-build:$PATH"

## Autocomplete for kdesrc-run
function _comp-kdesrc-run
{
  local cur
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"

  # Complete only the first argument
  if [[ $COMP_CWORD != 1 ]]; then
    return 0
  fi

  # Retrieve build modules through kdesrc-run
  # If the exit status indicates failure, set the wordlist empty to avoid
  # unrelated messages.
  local modules
  if ! modules=$(kdesrc-run --list-installed);
  then
      modules=""
  fi

  # Return completions that match the current word
  COMPREPLY=( $(compgen -W "${modules}" -- "$cur") )

  return 0
}

## Register autocomplete function
# complete -o nospace -F _comp-kdesrc-run kdesrc-run

################################################################################