Skip to content

Instantly share code, notes, and snippets.

@zaenk
Created May 1, 2019 06:57
Show Gist options
  • Save zaenk/2663d72e3c60b99781b76fbb4fe63026 to your computer and use it in GitHub Desktop.
Save zaenk/2663d72e3c60b99781b76fbb4fe63026 to your computer and use it in GitHub Desktop.
Git Bash for Windows with some proxy commands to WLS
#!/bin/bash
alias wbash="/c/Windows/System32/bash.exe"
convert_path() {
# repace GitBash /driveletters with WLS bash /mnt/driveletters
# note: this not works with 1 letter directory letters
params=$(echo $* | sed -e "s/\/\b\(.\)\//\/mnt\/\1\//g")
echo $params
}
ansible() {
params=$(convert_path $*)
wbash -c "ansible $params"
}
ansible-playbook() {
params=$(convert_path $*)
wbash -c "ansible-playbook $params"
}
ansible-galaxy() {
params=$(convert_path $*)
wbash -c "ansible-galaxy $params"
}
ansible-vault() {
params=$(convert_path $*)
wbash -c "ansible-vault $params"
}
dtop() {
while true; do clear; docker ps -a; sleep 5; done;
}
dhtop() {
docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.Name}}"
}
mysql_pw() {
echo -n "$1" | openssl sha1 -binary | openssl sha1 | tr 'a-z' 'A-Z' | awk '{ print "*"$2; }'
}
rsync() {
params=$(convert_path $*)
wbash -c "rsync $params"
}
export -f convert_path
export -f rsync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment