Skip to content

Instantly share code, notes, and snippets.

@Loongphy
Created June 5, 2024 05:59
Show Gist options
  • Save Loongphy/1062bfe06f925674c50dea23b9d3a3a9 to your computer and use it in GitHub Desktop.
Save Loongphy/1062bfe06f925674c50dea23b9d3a3a9 to your computer and use it in GitHub Desktop.
fish script
# ~/.config/fish/conf.d/config.fish
# WSL proxy
function proxy
# set ip (grep nameserver /etc/resolv.conf | cut -d " " -f 2) # if network=NAT in windows .wslconfig(it's the default behaviour)
set ip 127.0.0.1 # if network=MIRRORED in windows .wslconfig
export all_proxy=http://$ip:7890
git config --global http.proxy http://$ip:7890
git config --global https.proxy http://$ip:7890
end
# kill the process of the specified port
function kp
set port $argv[1]
lsof -i:$port | awk "NR==2{print $2}" | xargs kill -9
end
alias py="python3"
# git commands
alias main="git checkout main"
alias cl="git clone"
alias gp="git push"
alias gd="git branch | grep -v main | xargs git branch -D"
alias gpf="git push --force"
alias gpl="git pull --rebase"
alias gnoe="git commit --amend --reset-author --no-edit"
alias gc="git checkout"
function gda
# Fetch latest branches
git fetch --prune
# Loop through all branches except 'main' and delete them
for branch in (git branch | string replace '*' '' | string trim)
if test $branch != "main"
echo "Deleting branch: $branch"
git branch -D $branch
end
end
end
alias myip="curl ipinfo.io"
# Node.js @antfu/ni
alias d="nr dev"
alias lo="nr local"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment