Saturday 5 April 2014

Magic of Python

$ python -m SimpleHTTPServer
Download HTML Page
$ python -m urllib http://www.python.org > python.html

Prints the year calendar, like the "cal" command.

$ python -m calendar

Works as a command line ftp client

$ python -m ftplib

Sends email using localhost smtp server as relay.

$ python -m smtplib

Monday 24 March 2014

Installing and configuring the PostgreSQL databse and python libraries 

 

 

 

 

 

 

Tuesday 15 October 2013

Vim complete binding and Shortcuts


vim Complete Key Binding List


Definitions

  • UNBOUND - this key is not normally bound to any vi command
  • word - a lower-case word ("w", "b", "e" commands) is defined by a consecutive string of letters, numbers, or underscore, or a consecutive string of characters that is not any of {letters, numbers, underscore, whitespace}
  • Word - an upper-case word ("W", "B", "E" commands) is a consecutive sequence of non-whitespace.
  • sentence
  • paragraph
  • cursor motion command - any command which positions the cursor is ok here, including the use of numeric prefixes. In addition, a repeat of the edit command usually means to apply to the entire current line. For example, "<<" means shift current line left; "cc" means replace entire current line; and "dd" means delete entire current line. 

Key Bindings in Editing Modes

While in any edit mode (insert, replace, etc.) there are some keys that are used to adjust behaviour, rather than just to insert text.
  • ESC - leave edit mode, return to command mode  
  • ^D - move line backwards one shiftwidth. shiftwidth must be set, and either the line must be newly added, or ^T must have been used.
  • ^T - move all after cursor forwards one shiftwidth
  • ^H - deletes text that was entered during the current edit mode. Most versions of vi do not allow deleting to previous line.
  • ^V - insert next character even if it is a editing character. 

complete key binding reference



KeyActionFollowed by
aenter insertion mode after current charactertext, ESC
bback word
cchange commandcursor motion command
ddelete commandcursor motion command
eend of word
ffind character after cursor in current linecharacter to find
gUNBOUND
hmove left one character
ienter insertion mode before current charactertext, ESC
jmove down one line
kmove up one line
lmove right one character
mmark current line and positionmark character tag (a-z)
nrepeat last search
oopen line below and enter insertion modetext, ESC
pput buffer after cursor
qUNBOUND
rreplace single character at cursorreplacement character expected
ssubstitute single character with new texttext, ESC
tsame as "f" but cursor moves to just before found charactercharacter to find
uundo
vUNBOUND
wmove foreward one word
xdelete single character
yyank commandcursor motion command
zposition current lineCR = top; "." = center; "-"=bottom
Aenter insertion mode after end of linetext, ESC
Bmove back one Word
Cchange to end of linetext, ESC
Ddelete to end of line
Emove to end of Word
Fbackwards version of "f"character to find
Ggoto line number prefixed, or goto end if none
Hhome cursor - goto first line on screen
Ienter insertion mode before first non-whitespace charactertext, ESC
Jjoin current line with next line
KUNBOUND
Lgoto last line on screen
Mgoto middle line on screen
Nrepeat last search, but in opposite direction of original search
Oopen line above and enter insertion modetext, ESC
Pput buffer before cursor
Qleave visual mode (go into "ex" mode)
Rreplace mode - replaces through end of current line, then insertstext, ESC
Ssubstitute entire line - deletes line, enters insertion modetext, ESC
Tbackwards version of "t"character to find
Urestores line to state when cursor was moved into it
VUNBOUND
Wforeward Word
Xdelete backwards single character
Yyank entire line
Zfirst half of quick save-and-exit"Z"
0move to column zero
1-9numeric precursor to other commands[additional numbers (0-9)] command
(SPACE) move right one character
!shell command filtercursor motion command, shell command
@vi evalbuffer name (a-z)
#UNBOUND
$move to end of line
%match nearest [],(),{} on line, to its match (same line or others)
^move to first non-whitespace character of line
&repeat last ex substitution (":s ...") not including modifiers
*UNBOUND
(move to previous sentence
)move to next sentence
\UNBOUND
|move to column zero
-move to first non-whitespace of previous line
_similar to "^" but uses numeric prefix oddly
=UNBOUND
+move to first non-whitespace of next line
[move to previous "{...}" section"["
]move to next "{...}" section"]"
{move to previous blank-line separated section"{"
}move to next blank-line separated section"}"
;repeat last "f", "F", "t", or "T" command
'move to marked line, first non-whitespacecharacter tag (a-z)
`move to marked line, memorized columncharacter tag (a-z)
:ex-submodeex command
"access numbered buffer; load or access lettered buffer1-9,a-z
~reverse case of current character and move cursor forward
,reverse direction of last "f", "F", "t", or "T" command
.repeat last text-changing command
/search forwardsearch string, ESC or CR
<unindent commandcursor motion command
>indent commandcursor motion command
?search backwardsearch string, ESC or CR
^AUNBOUND
^Bback (up) one screen
^CUNBOUND
^Ddown half screen
^Escroll text up (cursor doesn't move unless it has to)
^Fforeward (down) one screen
^Gshow status
^Hbackspace
^I(TAB) UNBOUND
^Jline down
^KUNBOUND
^Lrefresh screen
^M(CR) move to first non-whitespace of next line
^Nmove down one line
^OUNBOUND
^Pmove up one line
^QXON
^Rdoes nothing (variants: redraw; multiple-redo)
^SXOFF
^Tgo to the file/code you were editing before the last tag jump
^Uup half screen
^VUNBOUND
^WUNBOUND
^XUNBOUND
^Yscroll text down (cursor doesn't move unless it has to)
^Zsuspend program
^[(ESC) cancel started command; otherwise UNBOUND
^\leave visual mode (go into "ex" mode)
^]use word at cursor to lookup function in tags file, edit that file/code
^^switch file buffers
^_UNBOUND
^?(DELETE) UNBOUND