summaryrefslogtreecommitdiff
path: root/.zshrc
diff options
context:
space:
mode:
Diffstat (limited to '.zshrc')
-rw-r--r--.zshrc140
1 files changed, 68 insertions, 72 deletions
diff --git a/.zshrc b/.zshrc
index 168ffa1..af8d7b3 100644
--- a/.zshrc
+++ b/.zshrc
@@ -1,4 +1,4 @@
-export ZSH="/usr/share/oh-my-zsh"
+export ZSH="/home/fkfd/.oh-my-zsh"
ZSH_THEME="fkfd"
@@ -15,46 +15,38 @@ 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"
+export PATH="$HOME/.local/bin:$HOME/.local/texlive/2024/bin/x86_64-linux:$PATH"
# utilities
mc () {
- mkdir $1 && cd $1
+ mkdir $1 && cd $1
}
-share () {
- src=$1
- if [[ $2 == '' ]]; then
- dst=$(basename $1)
- else
- dst=$2
- fi
- scp -r $src www@fkfd.me:www/static/$dst
- echo "https://fkfd.me/static/$(urlencode $dst)"
-}
-
-bright () {
- if [[ $1 == 10 ]]; then
- xrandr --output HDMI-A-0 --brightness 1
- return 0
- fi
- xrandr --output HDMI-A-0 --brightness "0.$1"
+# look at anything
+k () {
+ if [[ -d $1 ]]; then
+ ls $1
+ elif [[ -f $1 ]]; then
+ $EDITOR $1
+ fi
}
-mnt-cryfs () {
- cryfs "/data/Vaults/$1.enc" "$HOME/Vaults/$1"
-}
-
-umnt-cryfs () {
- cryfs-unmount "$HOME/Vaults/$1"
+share () {
+ src=$1
+ if [[ $2 == '' ]]; then
+ dst=$(basename $1)
+ else
+ dst=$2
+ fi
+ scp -r $src www@fkfd.me:www/static/$dst
+ echo "https://fkfd.me/static/$(urlencode $dst)"
}
# make aliases accessible in sudo
alias sudo="sudo "
alias incognito="unset HISTFILE"
-alias proxy="export SOCKS5_PROXY=localhost:1080; export HTTP_PROXY=http://localhost:1081; export HTTPS_PROXY=http://localhost:1081"
+alias proxy="export SOCKS5_PROXY=127.0.0.1:1080; export HTTP_PROXY=http://127.0.0.1:1081; export HTTPS_PROXY=http://127.0.0.1:1081"
# SSH
alias mrf="mosh root@fkfd.me"
@@ -66,27 +58,31 @@ alias gimme="sudo chown -R $USER ./ && sudo chmod -R +rw ./*"
alias lemme="sudo chmod +x"
# embedded
-alias ard="arduino-cli"
+alias espenv="source ~/p/esp/esp-idf/export.sh"
+alias mmu="make && make upload"
# 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="eza"
-alias dormshare="sudo python -m http.server -b 192.168.8.2 80"
-alias scanto="scanimage -d 'hpaio:/usb/HP_LaserJet_Professional_M1219nf_MFP?serial=000000000QJA9XJFPR1a' --source Flatbed --format=jpeg --mode=Gray --resolution=200 -x 210 -y 297 -o "
-
-alias tlmgr="/usr/share/texmf-dist/scripts/texlive/tlmgr.pl --usermode"
+PRINTER="hpaio:/usb/HP_LaserJet_Professional_M1219nf_MFP?serial=000000000QJA9XJFPR1a"
+alias scan="scanimage -d '$PRINTER' --source Flatbed --format=jpeg"
+alias scanto="scanimage -d '$PRINTER' --source Flatbed --format=jpeg --mode=Gray --resolution=200 -x 210 -y 297 -o "
alias catpic="montage -tile 1x -geometry +0+0"
+alias prc="perf record -F 1000 --call-graph=dwarf -e cycles:u"
+alias prp="perf report"
+
# fun
-alias rickroll="vlc -f '/data/Videos/Rick Astley - Never Gonna Give You Up (Official Music Video).mkv'"
+alias rickroll="vlc -f '~/Videos/Rick Astley - Never Gonna Give You Up (Official Music Video).mkv'"
+
+alias neofetch="if [[ $TERM == 'xterm-kitty' ]]; then neofetch --kitty ~/Pictures/branding/logos/arch.png --size 420px; else neofetch; fi"
# disable beep in x11
set -B 0
@@ -99,52 +95,52 @@ alias accel="killall kglobalaccel5 && kglobalaccel5&"
# TA work
alias gccc="gcc -pedantic -std=c11 -Wall -Wextra -Werror -Wno-unused-result -Wconversion -Wvla"
-# 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"
+# SJTU VPN
+vpn () {
+ if ! systemctl is-active --quiet strongswan; then
+ sudo systemctl start strongswan
+ fi
+ if [[ $1 == "on" ]]; then
+ sudo swanctl -i --child vpn-student
+ elif [[ $1 == "off" ]]; then
+ sudo swanctl -t --ike vpn-student
+ else
+ echo "Usage: $0 [on|off]"
+ fi
}
-
# kdesrc-build #################################################################
## Add kdesrc-build to PATH
-export PATH="$HOME/kde/src/kdesrc-build:$PATH"
+export PATH="/home/fkfd/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
+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
-
+complete -o nospace -F _comp_kdesrc_run kdesrc-run
################################################################################
-# opam configuration
-[[ ! -r /home/fkfd/.opam/opam-init/init.zsh ]] || source /home/fkfd/.opam/opam-init/init.zsh > /dev/null 2> /dev/null