Friday, November 16, 2012

Automatic connection to VPN server in Ubuntu Precise 12.04

Ubuntu Precise 12.04's NetworkManager service can be used to access VPN connections, and can be configured to connect at boot-time without having to add any additional packages to the system. Using the following script, I access my FreeBSD OpenVPN server (configuration was covered in a previous post) at boot time.

Save the following script to /etc/NetworkManager/dispatcher.d/02vpn :
#! /bin/bash

REQUIRED_CONNECTION_NAME="virt0"
VPN_CONNECTION_NAME="baitis vpn"


activ_con=$(nmcli con status | grep "${REQUIRED_CONNECTION_NAME}")
activ_vpn=$(nmcli con status | grep "${VPN_CONNECTION_NAME}")
if [ "${activ_con}" -a ! "${activ_vpn}" ];
then
    nmcli con up id "${VPN_CONNECTION_NAME}"
fi
Don't forget to mark the script as executable with chmod
chmod +x /etc/NetworkManager/dispatcher.d/02vpn

VPN_CONNECTION_NAME should correspond to whatever VPN connection you have configured using Network Manager. If, for some reason, you can't configure VPN connections in Network Manager, you may need to install the appropriate plug-in:
apt-get install network-manager-openvpn network-manager-openvpn-gnome

Sunday, November 11, 2012

"Life-changing" VIM plugin: "Screen"

Eric Van Dewoestine's Screen plugin for VIM is terrific. Not only is the plugin "life-changing," but it's also an exceptionally easy to install, and should serve as an example for other VIM plugin developers.

If you use VIM and enjoy the command line, make sure you check it out. I think this plugin is much better and far more intuitive than 'conque shell.'

Special hint: try pressing control-A control-A when the embedded shell is displayed.


If you don't use VIM, here's why you might want to try it:
  • You are a touch typist
  • You want to move around extremely rapidly in files without taking your fingers off of the keyboard
  • You want to do incredibly powerful bulk edits