Friday, August 22, 2014

Setting up VI or VIM for editing in Python

Exactly a year ago(ok more than a year ago) I had posted about how to set up color schemes in VIM. Back then i had just discovered the command :colorscheme. The shitty post can be seen here.

This year, my plan is to teach or re-teach myself python. I have been making good progress with the awesome free book Dive into python.
Now that I am a little bit more comfortable with Python and have been using it for day to day problem solving. I now need a development environment.
I use a windows machine at work with cygwin. I also use gvim. If you want to customize vim in cygwin, and want to customize gvim, both have their .vimrc files.

Here are some tips to remember in the future.

1. cygwin- You must install vim and not just vi. They are different. You can place your custom .vimrc in $HOME/.vim/vimrc. Note there is not a dot before the filename. To see if this file is being read by vim you can start vim in debug mode using vim -V . Read the output on the screen to see if your vimrc files was read. This is where you can put your own custom settings. 
2. Gvim - On windows the install path for this C:\program files(x86)/vim/. Here you will find a file _vimrc. This is where you can put your custom vim settings.

Now on to some custom settings that I have liked so far.

Colorscheme.

I liked the color scheme moria for gvim. It can be downloaded from here. To enable this in gvim enter the following line in your _vimrc file

color moria

I have not yet figured out how to enable this in vim in cygwin.

Python specific settings.

Following lines are pretty self explanatory for editing python files.

set textwidth=79  " lines longer than 79 columns will be broken
set shiftwidth=4  " operation >> indents 4 columns; << unindents 4 columns
set tabstop=4     " a hard TAB displays as 4 columns
set expandtab     " insert spaces when hitting TABs
set softtabstop=4 " insert/delete 4 spaces when hitting a TAB/BACKSPACE
set shiftround    " round indent to multiple of 'shiftwidth'
set autoindent    " align the new line indent with the previous line




Wednesday, April 30, 2014

GNU parallel tip


Tip about GNU parallel. Cos everything in linux requires stackoverflow.

http://stackoverflow.com/questions/16448887/gnu-parallel-not-working-at-all

Motivation about Nostalgia


I just read my own posts from past years. It is an amazing view into my own life. The most vivid memories are painted by posts from 2005. Back then I was really enthusiastic about Blogging or may be I had more time on my hand. Although I do believe that time is never really a problem. I do make time to shit right?. There the central theme of the blog "Shit", I said it.

Life has changed, I have changed and I am glad blogger is still there and has kept my blog around. Every year for the past few years, I have tried to write more, even said it publicly on this blog, that I will write more. Some how, I haven't done it. The reason- I blame life, yes you life, you are the source of all the problems in my life. I mean life happens. Time passes by and we all get responsibilities and suddenly your blog is empty.

So a new plan for this year, just write shit. I actually have opinions that when expressed in public usually piss people off, because people of my age get really sensitive about their own shit.
So this will be my sounding board from now on.

What do I plan to write here, just whatever shit I want, Didnt I say that in 2005 when i started this shit? Damn right I did, so what I can say it again and not do it again and blame life again for happening.
Actually no, I will, this time around. So the first post of the year 2014 is about  positive motivation.
If you wanna do something, be positive about it, imagine yourself doing it, tell your friends what you are going to do. Research has shown that when you do this,  you are more likely to do it. So if you talk positive about something to someone, you are more likely to succeed. Research has also shown that when you talk about your goals to others, you are more likely to not succeed as your brain is tricked into thinking that you have already accomplished that task.

So what does this tell us? That most research about motivation is shit,at least on the interwebs. So instead of doing a bunch of googling about how to be positive or keeping yourself motivated, or building up motivation to do something, just STOP! I have the solution for all your procrastination, this includes mine. Just read this one blog. That is it, it will make your ultra productive, and when you are productive, you will most likely be positive about shit in your life and achieve your goals.
Yes, there is not substitute for doing the shit that you intend to do. The hardest part is taking the first step and the hardest part is taking the second step, the third step, the forth and so on.. It is all really hard, just know it, understand and then just work at it.
I should have titled this post has Make money, one day when I become a famous blogger, I will.