-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshellrc
More file actions
103 lines (85 loc) · 2.75 KB
/
shellrc
File metadata and controls
103 lines (85 loc) · 2.75 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
## settings for bash or zsh
#
# vim:ft=sh:ts=4:sw=4:expandtab:
#
## PATH
PATH="$PATH:$HOME/.local/bin"
## Editor
#export VISUAL="gvim"
export EDITOR="vim"
## Android emulator
export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
## WeChall Warbox
export WECHALLUSER="Yinr"
export WECHALLTOKEN="84655-C5072-4BCEE-D07B7-5B1C6-5F8AE"
## copy to X clipboard
alias pbcopy="xclip -sel clip"
alias pbpaste="xclip -o -sel clip"
alias vi="vim"
alias yinr_aria2c="aria2c -c -m0 -x256 -j256 -k1M"
## mconnect
alias kde-send-text="mconnectctl share-text /org/mconnect/device/0"
alias kde-send-file="mconnectctl share-file /org/mconnect/device/0"
alias kde-send-url="mconnectctl share-url /org/mconnect/device/0"
## create_ap
WIFI_DEVICE='wlp3s0'
ap-enable() {
sudo create_ap --config ~/apps/configs/ap-${1:-$WIFI_DEVICE}.conf
}
alias ap-enable-enp2s0='ap-enable enp2s0'
alias ap-disable='sudo create_ap --stop $WIFI_DEVICE'
alias ap-running='create_ap --list-running'
alias ap-clients='create_ap --list-clients $WIFI_DEVICE'
## the fuck
## https://github.com/nvbn/thefuck
eval $(thefuck --alias well)
## fzf
if [ "${SHELL##*/}" = "zsh" ]; then
source /usr/share/fzf/completion.zsh
source /usr/share/fzf/key-bindings.zsh
elif [ "${SHELL##*/}" = "bash" ]; then
source /usr/share/fzf/completion.bash
source /usr/share/fzf/key-bindings.bash
fi
## noise generator
## usage:
## play-noise whitenoise # to play white noise
## play-noise pinknoise # to play pink noise
alias play-noise='play -n synth 60:00 '
## xmr-stak, the BCN miner
## usage:
## miner
## miner 9
## miner 7
## miner 5
miner() {
bin_path="/home/yinr/apps/xmr-stak"
if [ -f "${bin_path}/config-${1}.txt" ]; then
cfg=${bin_path}/config-${1}.txt
else
cfg=${bin_path}/config.txt
fi
if [ -f "${bin_path}/cpu-${1}.txt" ]; then
cpu=${bin_path}/cpu-${1}.txt
else
cpu=${bin_path}/cpu.txt
fi
${bin_path}/xmr-stak -c ${cfg} --cpu ${cpu}
}
## pipenv completion
which pipenv > /dev/null && eval "$(pipenv --completion)"
## play bilibili video via mpv using annie parser
bilimpv() {
info=$(annie -j "$1" | jq -r '.[0]')
title=$(echo $info | jq -r '.title') # 视频标题
# xml=$(echo $info | jq -r '.caption.url') # 弹幕 xml?
all=$(echo $info | jq -r '.streams|[.[]][-1]') # url 是 bili 链接,-1 取最高分辨率
quality=$(echo $all | jq -r '.quality') #显示分辨率
mp4="$(echo $all | jq -r '.parts[]|select (.ext=="mp4").url')"
m4a="$(echo $all | jq -r '.parts[]|select (.ext=="m4a").url')"
echo $title - $quality
mpv --referrer="${1}" --audio-file="${m4a}" "${mp4}"
}
## alias
alias steam-fix="sudo /media/yinr/Software/Entertainment/Steam/ascf"
alias npmtb="npm --registry 'http://registry.npm.taobao.org'"