Programmers Wallpaper banner

Homepage


CYTHON: BOOST PYTHON CODE PERFORMANCE

Jul 27, 2015

This tip is for those people who have been working on large python projects and the fact that python is a slow language as compared to statically compiled languages has finally caught up with them. This tip is about Cython, what it is and where can you use it for maximum effect.


What is Cython?

From the docs themselves,

Cython is an optimising static compiler for both the Python programming language and the extended Cython programming language (based on Pyrex).

The Cython language is a superset of the Python language that additionally supports calling C functions and declaring...



WRATH OF LINUX PACKAGE MANAGERS

Jul 09, 2015

We all love to characterise things as "More than the sum of it's parts". We'd like to say the same about our linux operating system. My ARCH is more than the sum of it's parts! Well.. no.

A linux system is exactly the sum of it's parts. And most of those parts are connected to the base package manager, the beast that acts like a framework, holding everything together.

Have you ever wondered what makes Ubuntu Ubuntu? Or what is the difference between ARCH and GENTOO? If you guessed a package manager, you'd be right.

You probably don't believe me?...



ESSENTIAL VIM PLUGINS

Jul 09, 2015

RECAP:

First, lets recap. Vim plugins are used to add functionality to vim. That functionality can be syntax highlighting, bracket matching, mode switching, easy file searching etc. Pretty much, there's a plugin for every functionality that is not built-in to vim.


INSTALLATIONS:

The way of installation varies with the type of plugin manager you are using. Almost all plugins are either developed or backed up on github. Most plugin managers make it trivial to install plugins from github repositories.

For pathogen, clone the plugin in the bundle folder in the .vim directory in your home folder.

For Vundle,...



VIM: SETTING A COLORSCHEME

Jul 08, 2015

Every good text editor deserves to have a customizable color scheme. For vim, colorschemes are installed as any other plugin. Most colorschemes can be downloaded as a .vim file. If you are not using a plugin manager, you need to copy the .vim file to an autoload folder inside a .vim folder in your home directory.

However, if you are using a plugin manager, (as you should), then depending on the plugin manager, the colorscheme may be installed like a plugin. Personally, I suggest you install a colorscheme-pack. Since it makes it trivially easy to switch to any colorscheme...



PLUGIN MANAGEMENT IN VIM

Jul 03, 2015

What I've written in this post is my opinion, and should not be taken as fact. There may be features I don't know about, and my preference order may not be same as yours.

Here is a quick overview of the plugin managers that I've used, ending with explanations on how to use my personal favorite, Vim-Plug. You may skip the comparision section if you just want to be started quickly.


3. PATHOGEN

No discussion of package managers is complete without mentioning pathogen. Pathogen is one of the oldest Package Manager for vim. It simply allows you to...



QUICK INTRO TO CUSTOM VIM MAPPINGS

Jul 01, 2015

One of the best things about vim is its ability to create custom mappings for almost any key in all modes.

Suppose you want Ctrl+S to save your document while you are in insert mode, because pressing

<Esc>:w<Enter>i 

to switch to normal mode, save the file, and return back to insert mode is a bit too much. According to vim philosophy, it actually is too much, and thus you can map Ctrl+S to those keys just as easily.

For this, add the following to your vimrc

inoremap <C-S> <Esc>:w<Enter>i 

EXPLANATION:

The command has separate parts but follows the...



VIM CUSTOMIZATION: GUIDE TO WRITING YOUR OWN VIMRC

Jul 01, 2015

Vim is all about customization. It comes from a long line of ancestors starting from ed (1971), ex (1976), vi (1979), and finally VIM (1991).

Vim is designed with the philosophy of speed and minimal keystrokes. But I guess, if you're on this page, you already know that.

The screenshot in above banner is how my vim looks currently. (In case you can't see it, click here) If you'd notice, there's a bar on the top showing the buffers I have currently open, the bottom bar shows the mode, character encoding, github branch (when I'm inside a project). The...



USING MOUSE WITH VIM IN THE TERMINAL

Jun 30, 2015

Just when you thought vim couldn't surprise you anymore, vim strikes again. As it turns out, vim supports mouse integration even in the terminal. Not only that, the support is mind blowingly simple and amazing. You can move your cursor, select text and even resize your panes in a split screen.

Most websites just say to use set mouse=a in your .vimrc to add mouse support to your vim. However, this enables mouse in all modes and I found that it can get very irritating if mouse gets moved during typing in insert mode. Luckily vim also supports selective usage...



PACKAGE MANAGEMENT WITHOUT ROOT ACCESS - AN INTRO TO LINUXBREW

Jun 26, 2015

First a little background. At my college, we are given login accounts for accessing PC's at the Computer Labs. I usually use them for setting up my work environment for easy access through SSH. Though that makes it very easy for me to resume my work, from any computer or laptop on the network, the preinstalled packages are too old for my taste.

Have a look:

Versions before LinuxBrew update

This is what we want to end up with:

Versions after LinuxBrew update

Of course, this can be achieved by compiling the...



IIT KANPUR: THE FIRST YEAR

Jun 18, 2015

First of all, I think congratulations are in order. If you are reading this, you have probably cracked one of the toughest exams in the world. After two years of hard work and challenges, you have finally succeeded! You have made it to one of the world's finest engineering colleges, the Indian Institutes of Technology.

Last two years must have been tough for you. You sacrificed on interaction with friends, computer games, movies, parties and what-nots. Now that the results of JEE Advanced are out, the time for an important decision has come. You have to choose which IIT and...