-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_functions
96 lines (82 loc) · 1.76 KB
/
dot_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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
yellow='\e[0;33m'
endColor='\e[0m'
function info () {
echo "${yellow}$1${endColor}"
}
function addalias() {
if [[ $# -eq 0 ]] ; then
info "addalias [alias] [command]";
info "Example: addalias d 'cd ~/Downloads'";
else
info "alias $1='$2'" >> $HOME/.aliases && source $HOME/.zshrc;
fi;
}
function camerausedby() {
info "Checking to see who is using the iSight camera… 📷"
usedby=$(lsof | grep -w "AppleCamera\|USBVDC\|iSight" | awk '{printf $2"\n"}' | xargs ps)
echo -e "Recent camera uses:\n$usedby"
}
function pull() {
git stash --include-untracked;
git pull;
git stash apply stash@{0};
}
function bandcamp() {
if [[ $# -eq 0 ]]; then
info "bandcamp [url]";
else
bandcamp-dl --full-album --no-slugify --embed-art $1;
fi;
}
function gac() {
if [[ $# -eq 0 ]]; then
info "gac [commit_message]";
else
git add --all;
git commit -m $1;
fi;
}
function gact() {
git add --all
git commit -m "update $(date +'%Y%m%d%H%M%S')"
}
function mkd() {
mkdir -p "$@" && cd "$_";
}
function youtube() {
if [ $# -eq 0 ]; then
info "youtube [url]";
else
youtube-dl -x --audio-format mp3 --audio-quality 320K --prefer-ffmpeg --embed-thumbnail --add-metadata $1;
fi;
}
function update() {
info "Updating Homebrew..."
brew update
info "Upgrading installed brews..."
brew upgrade
info "Update complete!"
}
nah() {
git reset --hard
git clean -df
}
newbranch() {
git checkout -b $1
git push -u origin $1
}
cmpush() {
pushd $HOME/.local/share/chezmoi > /dev/null
git add --all
git commit -m "update $(date +'%Y%m%d%H%M%S')"
git push
popd > /dev/null
}
function yy() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
}