Skip to content

Instantly share code, notes, and snippets.

@grunka
Last active April 14, 2022 13:42
Show Gist options
  • Save grunka/f2c2532807a3afbabbf7323ab7352336 to your computer and use it in GitHub Desktop.
Save grunka/f2c2532807a3afbabbf7323ab7352336 to your computer and use it in GitHub Desktop.
Fish Functions
function check-cert-dates -d "Gets the start and end date for a SSL certificate on a domain"
echo "" | openssl s_client -servername $argv -connect $argv:443 2>/dev/null | openssl x509 -noout -dates
end
function connect-vpn -d "Connect to VPN with Viscosity"
osascript -e "tell Application \"Viscosity\" to connect \"$argv\""
end
function debug-smtp -d "Start debug SMTP server"
sudo python -m smtpd -n -c DebuggingServer localhost:25
end
function disconnect-vpn -d "Disconnect from VPN with Viscosity"
osascript -e "tell Application \"Viscosity\" to disconnect \"$argv\""
end
function freshbrew -d "Update all Homebrew packages"
brew update && brew upgrade && brew cleanup
end
function get-functions -d "Fetches functions from gist"
pushd .
set gist f2c2532807a3afbabbf7323ab7352336
set tmp (mktemp -d)
cd $tmp
gh gist clone $gist
cp -v $gist/*.fish ~/.config/fish/functions
rm -rf $gist
popd
rmdir $tmp
end
function kubectl-admin -d "Open up kubernetes admin interface"
kubectl -n kube-system describe secret (kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') | grep "^token" | awk '{print $2}' | pbcopy
echo "Token copied to clipboard"
kubectl proxy -p 18001 &
open "http://localhost:18001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/pod?namespace=default"
fg
end
function set-java-11 -d "Set Java 11 as current version"
set -gx JAVA_HOME /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/
end
function set-java-8 -d "Set Java 8 as current version"
set -gx JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/
end
function set-java-default -d "Resets used Java to system default"
set -e JAVA_HOME
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment