Monday, December 31, 2018

Python - Using virtualenv

Step1: Create a virtual environment:

/opt3$ virtualenv runs02
Running virtualenv with interpreter /usr/bin/python2
New python executable in /opt3/runs02/bin/python2
Also creating executable in /opt3/runs02/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
/opt3$

Step 2: Activate the environment:

$ cd runs02
/opt3/runs02$ ls -l
total 0
drwxr-xr-x 2 mhc mhc 320 Dec 31 12:51 bin
drwxr-xr-x 2 mhc mhc  60 Dec 31 12:51 include
drwxr-xr-x 3 mhc mhc  60 Dec 31 12:51 lib
drwxr-xr-x 2 mhc mhc 100 Dec 31 12:51 local
drwxr-xr-x 3 mhc mhc  60 Dec 31 12:51 share
/opt3/runs02$ which source
opt3/runs02$ $ source bin/activate
(runs02) /opt3/runs02$

Step 3: Now install the needed packages using pip.

Installing pandas:

(runs02) /opt3/runs02$ pip install pandas
Collecting pandas
  Downloading https://files.pythonhosted.org/packages/b7/e3/f52d484244105fa3d558ce8217a5190cd3d40536076bef66d92d01566325/pandas-0.23.4-cp27-cp27mu-manylinux1_x86_64.whl (8.9MB)
    100% |████████████████████████████████| 8.9MB 2.2MB/s 
Collecting pytz>=2011k (from pandas)
  Downloading https://files.pythonhosted.org/packages/f8/0e/2365ddc010afb3d79147f1dd544e5ee24bf4ece58ab99b16fbb465ce6dc0/pytz-2018.7-py2.py3-none-any.whl (506kB)
    100% |████████████████████████████████| 512kB 10.7MB/s 
Collecting numpy>=1.9.0 (from pandas)
  Downloading https://files.pythonhosted.org/packages/de/37/fe7db552f4507f379d81dcb78e58e05030a8941757b1f664517d581b5553/numpy-1.15.4-cp27-cp27mu-manylinux1_x86_64.whl (13.8MB)
    100% |████████████████████████████████| 13.8MB 1.4MB/s 
Requirement already satisfied: python-dateutil>=2.5.0 in ./lib/python2.7/site-packages (from pandas) (2.7.5)
Requirement already satisfied: six>=1.5 in ./lib/python2.7/site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)
Installing collected packages: pytz, numpy, pandas
Successfully installed numpy-1.15.4 pandas-0.23.4 pytz-2018.7
(runs02) /opt3/runs02$



Reference:

Monday, December 17, 2018

VueJS - tools - vue.js dev tools



Step 1: In our chrome browser let us visit the site: https://chrome.google.com/webstore/category/extensions

Step 2: Search for Vue.js devtools:

Step 3: Click on Add to Chrome



Step 4: Click on Add extension:



Now Vue.js devtools has been added to our chrome browser. 

Sunday, December 2, 2018

curl - fetch headers of URL

To fetch only the headers of a HTTP URL, we can use the curl with the -I switch. Consider the following command line:


HTTP/2 200 
server: nginx
date: Sun, 02 Dec 2018 10:09:19 GMT
content-type: text/html; charset=UTF-8
set-cookie: wordpress_google_apps_login=3612792336cb3b1361acd56bb0addf07; path=/; secure
link: <https://www.stanford.edu/wp-json/>; rel="https://api.w.org/"
link: <https://www.stanford.edu/>; rel=shortlink
x-frame-options: SAMEORIGIN
vary: Accept-Encoding
wpe-backend: apache
x-wpe-loopback-upstream-addr: 127.0.0.1:6783
x-cacheable: NO:Set Known Cookie
cache-control: max-age=0, must-revalidate, private
x-cache: MISS
x-pass-why: 
x-cache-group: normal
x-type: default



In this we fetch the headers sent from the URL of the stanford university.