Start VPN from Command Line in Ubuntu

Show Connections

$ nmcli con

Start a Connection

$ nmcli con up id gateway.hollandamerica.com
$ nmcli con up id ConnectName

Stop a Connection

$ nmcli con down id gateway.hollandamerica.com
$ nmcli con down id ConnectionName

Refer: http://askubuntu.com/questions/57339/connect-disconnect-from-vpn-from-the-command-line

 

Ubuntu 14.04 Tweaks

Using Ubuntu 14.04 in Virtual Box on the Macbook Pro starting working really well, and I was able to take advantage of many of the advance features.  It does cause the fan to kick on when it runs for a while.

These settings really bumped up the performance

  • The clipboard bi-directional worked and so did the drag-n-drop setting
  • Motherboard, Extended Features, Enable I/O Apic
  • Use extra processor cores
  • Processor, Extended Features, Enable PAE/NX
  • Acceleration, Enable VT-x/AMD-V and Enabled Nested Paging
  • Video Memory 64 Meg
  • Storage, Controller SATA, Use Host I/O Cache - Really help YouTube Playback

Resize your VirtualBox

http://stackoverflow.com/questions/11659005/how-to-resize-a-virtualbox-vmdk-file

C:\Users\mruckman\VirtualBox VMs\Ubuntu-12.04-64-bit-16Gig-WINT-MLR\
Ubuntu-12.04-64-bit-16Gig-WCS-DEMO-disk1.vmdk

"C:\Program Files\Oracle\VirtualBox\VBoxManage" clonehd "Ubuntu-12.04-64-bit-16Gig-WCS-DEMO-disk1.vmdk" "cloned.vdi" --format vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage" modifyhd "cloned.vdi" --resize 51200
"C:\Program Files\Oracle\VirtualBox\VBoxManage" clonehd "cloned.vdi" "Ubuntu-12.04-64-bit-50Gig-WINT-MLR-disk1.vmdk" --format vmdk

Then you need to use gParted for LiveCD

Installing MongoDB in Ubuntu 12.04

Unable to install latest version in Ubuntu 12.04
Refer: http://gordoncluster.wordpress.com/2013/07/12/how-to-install-mongodb-on-virtualbox-ubuntu-12-04/

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list
sudo apt-get update

We're going to specifically install an older version (you will need to run this as root):
sudo su -
apt-get install mongodb-10gen=2.2.3

The service should already be running, the output: mongodb start/running, process 2254
sudo service mongodb status | stop | start

now we just run:
mongo

The output you should see is:
MongoDB shell version: 2.2.3
connecting to: test
>

UI Tools
http://www.robomongo.org/

MongoDB Restore

$ mongorestore --drop testcms

Using canned mockup with booking flow

Refer: https://www.npmjs.org/package/canned

  • $ npm install canned
  • Unzip canned responses in bookingflow folder canned.zip
  • Update configuration.js file
    cmsUrl: 'http://localhost:3000/hal-cms',
    dsUrl: 'http://localhost:3000/hal-ds',
  • Launch canned server from root of bookingflow, default port is 3000, left here for documentation
    ./node_modules/canned/bin/canned -p 3000 ./canned

Limitation, rest calls that return images do not work properly.

Example on how to define a call

  • You will need to determine if it is a get or a post to generate the proper index file of either index.post.json or index.get.json, see the last statement of example
  • Use chrome to get the URL of the rest call, and then also to get the curl version of the rest call
  • You can string all of these together and create a bash script to do everything at once

mkdir -p /home/mruckman/Documents/bookingflow/canned/hal-ds/rest/pricing/v1.0.0/companyCode/HAL/cpp/countryCode/US

cd /home/mruckman/Documents/bookingflow/canned/hal-ds/rest/pricing/v1.0.0/companyCode/HAL/cpp/countryCode/US

curl 'https://qabook.hollandamerica.com/hal-ds/rest/pricing/v1.0.0/...

Adding Prettify JSON to Sublime

In Ubuntu, open preferences, browse packages, to get location of packages folder, and open a terminal and change into that folder

$ git clone https://github.com/dzhibas/SublimePrettyJson.git

Ubuntu: /username/.config/sublime-text-2/Packages

The use [Ctrl]+[Alt]+[j] to run the prettify command

or in iOS us [Ctrl]+[Cmd]+[j]

Refer: https://github.com/dzhibas/SublimePrettyJson

Change your Computer Name in Ubuntu

Ran into trouble when using the same VirtualBox appliance on the same network.

1. Open a terminal window.

2. Input the following command and hit Enter:
gksudo gedit /etc/hostname

3. When prompted, enter the administrator password and click the OK button.

4. The hostname file will open, displaying the current computer name. Replace the current computer name with the desired new name.

5. Click Save.

6. Close all open windows and restart your system.

After your system has restarted, it will have the new computer name.

Use Python to format JSON

Easier way to format JSON instead of JSONLINT

With Python 2.6+ you can just do:
echo '{"foo": "lorem", "bar": "ipsum"}' | python -mjson.tool