Monday, February 9, 2015

How to use Junos Pulse VPN client on Ubuntu 12.04

Junos Pulse is a VPN client made by Juniper. It is widely used in companies. However, as far as I know, there is no released versions for Ubuntu OS, and I can only find versions for MAC OS and Windows.
I will introduce a way to use Junos Pulse on Ubuntu 12.04. The key thing is that we are going to use openconnect to do the same function as Junos Pulse. The latest version of openconnect (v7.04) has the support of Juniper clients:

What you need to do is to:

(1) install pre-requested libraries:
sudo apt-get install vpnc
sudo chmod a+x+r -R /etc/vpnc
sudo apt-get install libxml2 libxml2-dev gettext make libssl-dev pkg-config libtool autoconf git

(2) clone the openconnect repo (http://www.infradead.org/openconnect/download.html)
git clone git://git.infradead.org/users/dwmw2/openconnect.git

(3) build and install openconnect
cd openconnect
autoreconf -iv
./configure
make
sudo make install

(4) run openconnect
sudo LD_LIBRARY_PATH="/usr/local/lib" openconnect --juniper --no-cert-check your.vpn.server.com

Tuesday, October 7, 2014

How to add default network search domain on Ubuntu 12.04

Why?
you can use ping p1.google.com
if you added google.com to the default search domain, you only need to do ping p1.
This is especially needed for Erlang.

Forwarded from:
http://askubuntu.com/questions/135629/how-to-add-some-additional-dns-search-domains-without-ignoring-the-ones-returned

You will need to edit this file with your favorite editor:
sudo vim /etc/dhcp/dhclient.conf
Once in file, you should see a commented line with the word supersede next to it:
#supersede domain-name "...."
Uncomment that line, substitute the name supersede for append, then add the domain names you wish to search (follow the example below and leave a space after the first "):
append domain-name " ubuntu.com ubuntu.net test.ubunut.com";
Save the file and close.
All you need to do is restart your network connection. You can do this by unplugging and plugging in the physical network connect OR disable and enable your network connect (see picture below). After that you should be good to go:
To verify:
sudo cat /etc/resolv.conf
Disconnect Network
enter image description here
Connect Network
enter image description here

Thursday, April 24, 2014

VIM useful commands

:sort
to sort all the lines in the current file

:sort u
to sort and then unique all the lines in the current file

:%!sort -R
to shuffle all the lines in the current file

:%!xxd
to view the current file in hex mode


Friday, March 7, 2014

How to combine combine images/pdfs on Ubuntu?

1. Ubuntu 12.04 pdf printer
sudo apt-get install cups-pdf

2. Combine images into a pdf file
imagemagick is a command line toolkit to modify image files
sudo apt-get install imagemagick
convert 1.png 2.jpg output.pdf


3. Combine pdfs into a single pdf file
pdfshuffler is a GUI toolkit for your use
sudo apt-get install pdfshuffler
pdfshuffler

Wednesday, December 18, 2013

Chrome: the World Clock app installs malware with it


I just found that the World Clock app in Chrome installs a malware with it which pops up ads when you browse webpages. The link of the malware is:
 http://intext.nav-links.com

If you want to get rid of the malware, just uninstall the World Clock app.

Saturday, December 7, 2013

MAC OS: compile Megam for Moses

Megam is a machine learning tool which can be found at:
http://www.umiacs.umd.edu/~hal/megam/

It is required by the pair-wise ranking optimization (PRO, which is a replacement of MERT) of Moses.
It releases its binary executable version on Linux which can run on most Linux systems, but it does not have a binary executable version for MAC OS. We have to compile it by ourselves.

MAC OS version: 10.8.5
Port version: MacPorts 2.2.1
Megam version: 0.92 (Fifth Release 17 August 2007)
Moses version: 1.0

1. install ocaml using port on MAC OS:
sudo port install ocaml

2. go to the MERT directory of Moses:
cd mosesdecoder-RELEASE-1.0/mert

3. download Megam:
wget http://hal3.name/megam/megam_src.tgz
tar -xzvf megam_src.tgz (creating a directory megam_0.92)
cd megam_0.92

4. change megam's Makefile:
(1) replace "WITHSTR =str.cma -cclib -lstr" with:
WITHSTR =str.cma -cclib -lcamlstr
(2) replace "WITHCLIBS =-I /usr/lib/ocaml/caml" with:
WITHCLIBS =-I /opt/local/lib/ocaml/caml/

5. compile:
make opt

6. link:
cd .. (to mosesdecoder-RELEASE-1.0/mert)
ln -sf megam_0.92/megam.opt megam_i686.opt

Now you can run mert-moses.pl with PRO tuning.