Skip to content

Instantly share code, notes, and snippets.

@anakaiti
Created June 5, 2020 07:57
Show Gist options
  • Save anakaiti/f18d7a10db82f59e4db3eaf3bf2d127d to your computer and use it in GitHub Desktop.
Save anakaiti/f18d7a10db82f59e4db3eaf3bf2d127d to your computer and use it in GitHub Desktop.
# Selects and connects to a vpn
# Put .ovpn files in ~/vpn
function vpn --description 'Connect to vpn'
# Change to your prefered browser
set browser firefox
sudo -v
set ovpn ~/vpn/(ls ~/vpn/*.ovpn | tr '/' '.' | cut -d '.' -f 5 | fzf).ovpn
if test -e {$ovpn}.url
# If filename.ovpn.url exists, open the url inside the file
$browser (cat {$ovpn}.url)
end
sudo openvpn $ovpn
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment