-
Notifications
You must be signed in to change notification settings - Fork 1
/
.sh_functions
78 lines (63 loc) · 1.59 KB
/
.sh_functions
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
#!/usr/bin/env bash
mkcd() {
mkdir -pv $1 && cd $1
}
fdNvimRtp() {
local search_term="${1:-.}"
nvim -e -s -c "set runtimepath?" \
| sed s/runtimepath=// | tr "," $IFS | awk '{$1=$1};1' \
| xargs fd $search_term --max-depth=1 2>/dev/null
}
# TODO: rewrite in dash-compatible way
nvmuse() {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm use $@
SetWebCerts
}
SdkManInit() {
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
}
RBInit() {
eval "$(rbenv init - zsh)"
}
SetWebCerts() {
export NODE_EXTRA_CA_CERTS="/tmp/mega.pem"
if [ ! -f $NODE_EXTRA_CA_CERTS ]; then
security find-certificate -a -p /Library/Keychains/System.keychain > $NODE_EXTRA_CA_CERTS
fi
}
#tea-magic() {
# [[ -d "$HOME/.tea" ]] && source <("$HOME/.tea/tea.xyz/v*/bin/tea" --magic)
#}
function afk() {
echo "set i to 0
repeat while i < 20
tell application \"System Events\" to key code 80
set i to i + 1
delay 180
end repeat" | osascript
}
function vo() {
vim $(fd | fzf)
}
function trash() {
(
set -o errexit
set -o nounset
set -o pipefail
set -o xtrace
for file in $@; do
mv $file ~/.local/share/Trash/files/
cat <<EOF > ~/.local/share/Trash/info/$(basename $file).trashinfo
[Trash Info]
Path=$(realpath $file)
DeletionDate=$(date +%Y-%m-%dT%H:%M:%S)
EOF
done
)
}
[[ -r ~/dotfiles/bin/clone ]] && source ~/dotfiles/bin/clone
[[ -r ~/dotfiles/wmt.sh ]] && source ~/dotfiles/wmt.sh