-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
152 lines (117 loc) · 3.73 KB
/
.aliases
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
# fucking conda being conda
alias python=python3
alias pip=pip3
export CONDA_AUTO_ACTIVATE_BASE=false
# kitty stuff, probably should not override ssh
alias ssh='ssh -R 50000:${KITTY_LISTEN_ON#*:}'
# Application shorthands
export vs="Visual Studio Code"
export ij="IntelliJ IDEA"
# Path shorthands
export aise='/Users/Aral/Aral/Delft/YEAR 4'
export research='/Users/Aral/Aral/Delft/YEAR 4'
export rp="/Users/Aral/Aral/Delft/YEAR 3/0 RESEARCH PROJECT/LLM4CodeCompression"
export ml="/Users/Aral/Desktop/Music Library"
export brain="/Users/Aral/Library/Mobile Documents/iCloud~md~obsidian/Documents/Brain 2.0"
export dev='/Users/Aral/Aral/Dev'
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# fucking conda being conda
alias python=python3
alias pip=pip3
# some more ls aliases
alias ll='ls -alFh'
alias la='ls -A'
alias l='ls -CF'
# Command Shorthands
function mkd() {
mkdir $1
cd $1
}
function cl() {
cd $1
ls
}
function killge() {
if [ "$#" -lt 1 ]; then
echo 'Usage: killge <higher_than_pid>'
return
fi
# prompt the user first
to_kill=$(ps aux | awk -v treshold=$1 '$2 >= treshold')
echo "$to_kill"
echo '> Kill the above processes? (y/n)'
read -r answer
if [[ "$answer" == "y" ]]; then
echo "Confirmed. Proceeding..."
pids_to_kill=$(echo "$to_kill" | awk '{print $2}' | tail -n +2)
kill $pids_to_kill
elif [[ "$answer" == "n" ]]; then
echo "Aborted."
else
echo "Invalid input. Aborted."
fi
}
function setup_daic() {
# installing user-locally from source because this daic server hates its users
# Creates ~/local, and ~/local/bin to store the binaries (linked to PATH)
# guide; https://github.com/tmux/tmux/wiki/Installing
echo 'updating PATH'
echo 'export PATH=$HOME/local/bin:$PATH' >> $HOME/.bashrc
mkdir ~/local
cd ~/local
mkdir bin
## download and install libevent (for user)
echo 'installing libevent (tmux dependency)...'
wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
tar xf libevent-2.1.12-stable.tar.gz > /dev/null
cd libevent-2.1.12-stable
./configure --prefix=$HOME/local --enable-shared
make && make install
# remove installation files
cd ..
rm -rf libevent-2.1.12-stable
rm -rf libevent-2.1.12-stable.tar.gz
## download and install tmux
echo 'installing tmux...'
wget https://github.com/tmux/tmux/releases/download/3.4/tmux-3.4.tar.gz
tar xf tmux-3.4.tar.gz > /dev/null
cd tmux-3.4
PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig ./configure --prefix=$HOME/local
make && make install
# remaining setup
# LD_LIBRARY_PATH=$HOME/local/lib $HOME/local/bin/tmux -V
# MANPATH=$HOME/local/share/man man tmux
echo 'export PATH=$HOME/local/bin:$PATH' >> .bash_profile
echo 'export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH' >> .bash_profile
echo 'export MANPATH=$HOME/local/share/man:$MANPATH' >> bash_profile
export PATH=$HOME/local/bin:$PATH
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
export MANPATH=$HOME/local/share/man:$MANPATH
# remove installation files
cd ..
rm -rf tmux-3.4
rm -rf tmux-3.4.tar.gz
## download and install latest vim
echo 'installing vim...'
git clone https://github.com/vim/vim.git
cd vim/src
./configure --prefix=$HOME/local
make -s > /dev/null
make install -s > /dev/null
# remove installation files
cd ../..
rm -rf vim
cd $HOME
}
# shouldn't run this too often because it lags the GPU
alias nv='watch -d -n "10" nvidia-smi'
alias gis='git status'
alias giff='git diff'