-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
executable file
·170 lines (138 loc) · 4.14 KB
/
bashrc
File metadata and controls
executable file
·170 lines (138 loc) · 4.14 KB
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
168
169
170
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
export XIM_PROGRAM=fcitx
export INPUT_METHOD=fcitx
export XMODIFIERS=@im=fcitx
export QT_IM_MODULE=fcitx
export GTK_IM_MODULE=fcitx
export XIM=fcitx
export EDITOR=/usr/bin/vim
export SDL_IM_MODULE=fcitx
# show git branch and repository name
function parse_git_dirty {
[[ $(git status 2>/dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
function parse_git_repo_name {
ret=$(git remote -v 2>/dev/null | grep origin) && info=${ret##*/} && info=${info%% (*} && echo "$info"
}
function parse_git {
if [ ! -n "$(parse_git_repo_name)" ]; then
echo ""
else
echo "($(parse_git_repo_name)ᚬ$(parse_git_branch))"
fi
}
export PS1='\[\033[01;32m\][\u@\h \[\033[01;37m\]\W\[\033[01;32m\]$(type -t parse_git >/dev/null && parse_git)]\$\[\033[00m\] '
# copy current path to clip
alias ccp='pwd | awk '\''{printf $0}'\'' | xclip -sel clip'
# to clip; exp: ls | toclip; auto remove '\n'
alias toclip='awk '\''{printf $0}'\'' | xclip -sel clip'
# proxy on/off
function proxy_on() {
export http_proxy=127.0.0.1:12333
export https_proxy=127.0.0.1:12333
}
function proxy_off() {
unset http_proxy
unset https_proxy
}
function pre_proxy() {
export http_proxy=127.0.0.1:12333
export https_proxy=127.0.0.1:12333
$@
unset http_proxy
unset https_proxy
}
alias proxyon='proxy_on'
alias proxyoff='proxy_off'
alias preproxy='pre_proxy'
alias proxytest='preproxy curl cip.cc'
# history command
export HISTTIMEFORMAT="%Y/%m/%d %T "
export HISTSIZE=10000
export HISTFILESIZE=10000
# safe rm
# If the last character of the alias value is a blank, then the next command word following the alias is also checked for alias expansion.
alias sudo='sudo '
alias rm='bash ~/Software/bin/safe_rm/move_to_trash.sh'
# copy current path to clip
alias ccp='pwd | awk '\''{printf $0}'\'' | xclip -sel clip'
# to clip; exp: ls | toclip; auto remove '\n'
alias toclip='awk '\''{printf $0}'\'' | xclip -sel clip'
# Get file/folder full path
function ls_pwd() {
ls -1 $1 | awk '{print i$0}' i=$(pwd)'/'
}
alias lsp='ls_pwd'
# Gen passwd
function gen_passwd() {
echo "This is a simple password generator"
for p in $(seq 1 5); do
openssl rand -base64 48 | cut -c1-$1
done
}
# 自定义cheats路径
export NAVI_PATH="~/Archives/docs/cheats"
eval "$(navi widget bash)"
# 从.env文件中导入环境变量
function myenvs() {
if [ -z "$1" ]; then
echo "Usage: myenvs [import file path]"
else
if [ -f "$1" ]; then
source "$1" 2>/dev/null
export $(cat "$1" | grep "=" | grep -v "^#" | awk /./ | cut -d= -f1 | xargs)
else
echo "Bad file path: $1"
fi
fi
}
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/miniconda3/bin/conda' 'shell.bash' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/miniconda3/etc/profile.d/conda.sh" ]; then
. "/opt/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# nvm
source /usr/share/nvm/init-nvm.sh
# for gdb
#ulimit -c 409600
export PATH="/opt/platforms/x64/rootfs/bin:$PATH"
export PATH="~/Software/bin:$PATH"
export ELECTRON_OZONE_PLATFORM_HINT=auto
export PATH="~/.local/bin:$PATH"
alias task='asynctask -f'
bind '"\e[15~":"task\n"'
# esp32
#source /opt/esp-idf/export.sh
alias esp='source /home/shacon/.espressif/python_env/idf5.5_py3.14_env/bin/activate && source ~/.esp/v5.5/esp-idf/export.sh'
# tars
alias tars='python /home/shacon/Workspace/autoai/tools/tars.py'
# android
export ANDROID_SDK_ROOT=$HOME/Android/sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bind:$ANDROID_SDK_ROOT/platform-tools
export ANDROID_NDK=/opt/platforms/android/android-ndk-r23b
# starship prompt
eval "$(starship init bash)"
# hifi
#alias hifi='source /home/shacon/.hifi/env.sh'
alias hifi='bash /home/shacon/.hifi/hifi.sh'
# how to use
# cat arch.bashrc > ~/.bashrc