Created
March 27, 2022 17:14
-
-
Save so-jelly/674088a9ef5403c3815890e0915a9b37 to your computer and use it in GitHub Desktop.
public shell functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
branchclean () { | |
for branch in $(git branch | grep -v master) | |
do | |
git branch -d $branch | |
done | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gbc () { | |
git branch $1 | |
git checkout $1 | |
git push --set-upstream origin $1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sconnect() { | |
port=$(docker run 0bel1sk/open-ports) | |
case $2 in | |
443) | |
echo "$1 will be available at https://localhost:${port}" | |
;; | |
7075) | |
echo "$1 will be available at http://localhost:${port}" | |
;; | |
*) | |
echo "$1:$2 forwarding to $port" | |
;; | |
esac | |
ssh $1 -L "${port}:localhost:${2}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch () { | |
while true | |
do | |
clear | |
printf "[%s] Output of %s:\n" "$(date)" "$*" | |
${SHELL-/bin/zsh} -c "$*" | |
sleep 1 | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment