Tuesday, January 10, 2017

Terminal and vi quick navigation commands



Terminal shortcuts :


Ctrl + L  clear screen
Ctrl + D logout
Ctrl + A cursor to start of the line
Ctrl + E cursor to End of the line
Ctrl + U Delete left of the cursor
Ctrl + K Delete right of the Cursor
Ctrl + W Delete word on the left of cursor
Ctrl + Y Paste


Vi shortcuts

Insert text :

i Insert before cursor
I Insert before line
a Append after cursor
A Append after line
o Open new line after current line
O open new line before current line

Cursor move:

0 Takes to starting of the line
$ Takes to End of the line
w Move to next word
b Move to the beginning of the word
e Move to end of the word
( Move a sentence back
) Move a sentence forward 
1G Move to the first line of the file
G Move to last line of the file


Deleting Text :

x Delete character to right of the cursor
X Delete character to left of the cursor
D Delete to end of the line

Sunday, May 15, 2016

Accessing the API using api_key through python and retrieving the data

 

Following python script connects to public api using the api_key and we can retrieve the data from it. In order to get authenticated and read data we need to get the api_key.

# The python script is to test  connection to public api using the api_key and load the data based on the selection of object attributes

image 
Once we execute the script, sample output is as below.

C:\u01\Python-2711\python.exe C:/Users/xxxxxx/PycharmProjects/Learning/APIConnect.py
Please enter the city where you like to search : Nashua
Planet Fitness (603) 816-3555 03063
Cravings (603) 882-6626 03060
Thousand Crane II (603) 579-0888 03060
Preciou's Hair Salon (603) 882-0443 03060
Supercuts (603) 594-8545 03060
Tom's Barber Shop (603) 889-0223 03060
xxxxxxx