Archive for July, 2010
[Moved] Regular Expression To Check For Prime Numbers
Moved to http://www.malloc.co/regular-expressions/check-if-a-number-is-prime-using-a-regular-expression/
Firefox Extensions To Make Web Pages More Eye Friendly
To understand what I’m talking about, take a look at Dr Chip’s Vim Website which is a great resource about vim-related stuff, but is an extremely ugly website, I mean, it really hurt my eyes whenever I visit it.
If you use Firefox, then you can easily solve this problem with these two Firefox extensions. Both serve the same purpose: Making websites easier to read, by removing distractions and allowing you to focus on the content instead. Each one displays the website in a different style, and they have different options. I installed both and use them alternately (and regularly).
Colorize Make, GCC and Diff’s Output
Generally, output is more readable when it has colors to allow you distinguish between warnings, errors and progress logs.
Using colormake, colorgcc and colordiff, you can have the output of make, gcc, diff (respectively) coloured.
To install in Ubuntu:
sudo apt-get install colorgcc colormake colordiff
You might want to use aliases to override the normal make/gcc/diff commands.
Original tip from here.
Fix Bad Indentation When Pasting Text To Vim
The problem is this:
You’re editing a buffer in vim, you copy a text (say, code snippet) from another place (say, Firefox), and you paste it inside vim (with middle mouse button / shift+insert). Most chances you won’t like what vim has just did to your text.
The problem is that vim doesn’t “know” that you’re actually pasting a text, and it thinks that you’re typing. So, if you have indentation enabled, it will re-indent your text.
The solution is simple: Whenever you want to paste text from outside vim into vim. Type this in command mode:
:set paste
So now vim knows that you’re going to paste text, and it will not touch it.
To disable the paste mode:
:set nopaste
As easy as that
NumPad Problems When Using Vim over Tmux
I use vim as my main text editor, and I usually split the screen to edit a few buffers in parallel. To make resizing the windows faster, I mapped the numpad keys “/*-+” to resize the windows (see original vim tip here).
Recently, I started to use tmux, and opened vim, split the windows as usual, and tried to resize them. It didn’t work
I use Ubuntu 10.04 (Don’t remember the exotic name..), and I found that the latest tmux package in their repo is 1.1-1.
Anyway, version 1.1-1 has a bug with the NumPad. The solution is to download the source of tmux 1.2 and build it. It depends on libevent so you’ll need to get it first:
this is how to make it work:
1. sudo apt-get install libevent-dev
2. Get the source tarball of tmux from here.
3. tar xzf tmux-1.2.tar.gz
4. cd tmux-1.2
5. ./configure
6. make
7. sudo make install
Done. Now your life is better. Have fun
About Me
Tags
Categories
- Algorithms
- Bash
- BlackBerry
- Collaboration
- Command Line
- Cool Tricks
- Easter Eggs
- Ebooks
- Firefox
- Hardware
- Humor
- iPhone
- Linux
- Linux Development
- Linux Kernel
- Networks
- Open Knowledge
- Other
- Productivity
- Programming
- Regular Expressions
- Science
- Security
- Shell Scripts
- Short Posts
- Social Networks
- Thoughts
- Tools
- Vim
- Web Development
- Websites
Popular Posts
Calendar
Archives
- September 2010 (2)
- August 2010 (2)
- July 2010 (5)
- June 2010 (1)
- May 2010 (1)
- April 2010 (3)
- March 2010 (1)
- January 2010 (1)
- December 2009 (2)
- September 2009 (13)
- July 2009 (1)
- June 2009 (6)
- May 2009 (4)
- March 2009 (18)
- February 2009 (10)
- January 2009 (10)
- December 2008 (7)
- November 2008 (8)
- October 2008 (1)
- August 2008 (1)
- July 2008 (1)
- June 2008 (1)
