Last active
December 20, 2022 19:30
-
-
Save Harwood/a0e1dcca64509cc35276a3dcffd69ea3 to your computer and use it in GitHub Desktop.
Collection of fish 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
function cidr --description "return ip range for a domain" | |
dig $argv +short | xargs whois | grep CIDR | awk '{ print $2 }' | |
end |
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
function clean-dev --description "Resets git repos to remote's state with master checkout" | |
src_dirs $HOME/Developer/*/ $HOME/GitHub/*/ | |
for repo in $src_dirs | |
if [ -d $repo/.git ] | |
echo $repo | |
git -C $repo stash clear | |
git -C $repo fetch --all --multiple --prune --prune-tags --tags | |
git -C $repo checkout master --force | |
git -C $repo reset --hard origin/master | |
git -C $repo branch | grep -v "^\\*" | xargs git -C $repo branch -D | |
git -C $repo pull --all --autostash --gpg-sign --jobs=4 --progress --prune --recurse-submodules --stat --tags | |
end | |
end | |
end |
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
alias cp='rsync --progress -ah' |
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
alias dc='docker-compose' |
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
function docker-purge --description 'Removes all locally stored containers and images' | |
docker container list --quiet | xargs docker container stop | |
docker container prune --force | |
docker image prune --all --force | |
end |
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
/Users/harwood/.local/share/omf/themes/lambda/fish_prompt.fish |
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
function git --wraps hub --description 'Alias for hub, which wraps git to provide extra functionality with GitHub.' | |
hub $argv | |
end |
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
alias newsboat='env EDITOR=\'vim -u NONE\' newsboat' |
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
function pip-update --description 'Updates all Python 2 & 3 packages' | |
switch (uname) | |
case Darwin | |
set permissions '' | |
case Linux | |
set permissions '-n1 sudo -H' | |
case '*' | |
set permissions '' | |
end | |
# update python 2 | |
if hash pip2 2> /dev/null | |
echo 'Updating Python 2....' | |
pip2 list --outdated | tail -n +3 | awk '{ print $1 }' | xargs $permissions pip2 install --upgrade | |
end | |
# update python 3 | |
if hash pip3 2> /dev/null | |
echo 'Updating Python 3....' | |
pip3 list --outdated | tail -n +3 | awk '{ print $1 }' | xargs $permissions pip3 install --upgrade | |
end | |
end |
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
function pull-src --description 'Updates all source repos' | |
set -l src_dirs $HOME/Developer/* $HOME/GitHub/* $HOME/src/* | |
echo "----- Starting YADM -----" | |
yadm pull --all --autostash --gpg-sign --jobs=4 --progress --prune --recurse-submodules --stat --tags | |
echo "----- Finishing YADM -----" | |
echo "" | |
for dir in $src_dirs | |
if [ -d $dir/.git ] | |
echo "----- Starting $dir -----" | |
git -C $dir fetch --all --multiple --prune --prune-tags --tags | |
git -C $dir pull --all --autostash --gpg-sign --progress --prune --recurse-submodules --stat --tags | |
echo "----- Finishing $dir -----" | |
echo "" | |
else if [ -d $dir/.svn ] | |
echo "----- Starting svn update of $dir -----" | |
svn update $dir | |
echo "----- Finishing svn update of $dir -----" | |
echo "" | |
end | |
end | |
end |
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
alias torcheck='curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ | cat | grep -m 1 Congratulations | xargs' |
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
alias tree='tree -CAFS' |
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
function urldecode --description 'Urldecode string' | |
python3 -c "import sys, urllib.parse as parse; print(parse.unquote_plus('$argv'))" | |
end |
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
function urlencode --description 'Urlencode string' | |
python3 -c "import sys, urllib.parse as parse; print(parse.quote_plus('$argv'))" | |
end |
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
alias vi='vim -u NONE' |
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
alias yadm='yadm --yadm-dir ~/.config/yadm' | |
# using https://fishshell.com/docs/current/commands.html#complete | |
complete --command yadm --wraps lab |
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
function yadmUpdate | |
set currDate (date +%D-%H%M) | |
yadm checkout -b $currDate | |
yadm commit -S -m "Update in $currDate" ;and \ | |
yadm checkout master ;and \ | |
yadm merge $currDate ;and \ | |
yadm push --set-upstream origin master | |
yadm branch --delete $currDate | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment