dotfiles/home/shell_funcs

41 lines
941 B
Plaintext
Raw Normal View History

2022-10-05 03:42:00 +00:00
#!/bin/bash
2022-10-04 19:51:20 +00:00
# Functions
function httpdiff () {
2024-01-30 19:49:02 +00:00
diff --color -r -c <(curl -s "$1" 2>&1) <(curl -s "$2" 2>&1)
2022-10-04 19:51:20 +00:00
}
function cpbr () {
2024-01-30 19:49:02 +00:00
if branch=$(git symbolic-ref --short -q HEAD); then
2022-10-04 19:51:20 +00:00
printf "$branch" | pbcopy
osascript -e "display notification \"$branch copied to clipboard\" with title \"cpbr\""
else
echo "no branch, can't copy"
fi
}
function settitle () {
echo -ne "\033]0;"$*"\007"
}
function pullall (){
for d in ./*/ ; do (cd "$d" && pwd && git pull); done
}
function gh_mainall (){
for d in ./*/ ; do (cd "$d" && pwd && git checkout main && git pull); done
}
function allbranches (){
for d in ./*/ ; do (cd "$d" && pwd && git remote -v origin && git pull); done
}
function new_dock_space (){
2024-01-30 19:49:02 +00:00
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock
2022-10-04 19:51:20 +00:00
}
2023-09-27 20:31:31 +00:00
2024-05-20 14:07:28 +00:00
function agr (){
ag -0 -l "$1" | xargs -0 perl -pi.bak -e "s/$1/$2/g";
}